mirror of
https://github.com/versity/versitygw.git
synced 2026-01-03 10:35:15 +00:00
108 lines
3.2 KiB
Plaintext
108 lines
3.2 KiB
Plaintext
FROM ubuntu:latest
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
ARG SECRETS_FILE=tests/.secrets
|
|
ARG CONFIG_FILE=tests/.env.docker
|
|
ARG GO_LIBRARY=go1.21.13.linux-arm64.tar.gz
|
|
# see https://github.com/versity/versitygw/issues/1034
|
|
ARG AWS_CLI=awscli-exe-linux-aarch64-2.22.35.zip
|
|
ARG MC_FOLDER=linux-arm64
|
|
|
|
ENV TZ=Etc/UTC
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
git \
|
|
make \
|
|
wget \
|
|
curl \
|
|
unzip \
|
|
tzdata \
|
|
s3cmd \
|
|
jq \
|
|
bc \
|
|
libxml2-utils \
|
|
xmlstarlet \
|
|
python3-pip \
|
|
python3-venv \
|
|
xxd \
|
|
ca-certificates && \
|
|
update-ca-certificates && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /tmp
|
|
|
|
# Install AWS cli
|
|
RUN curl "https://awscli.amazonaws.com/${AWS_CLI}" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
|
|
|
|
# Install mc
|
|
RUN curl https://dl.min.io/client/mc/release/${MC_FOLDER}/mc \
|
|
--create-dirs \
|
|
-o /usr/local/minio-binaries/mc && \
|
|
chmod -R 755 /usr/local/minio-binaries
|
|
ENV PATH=/usr/local/minio-binaries:${PATH}
|
|
|
|
# Download Go 1.21 (adjust the version and platform as needed)
|
|
RUN wget https://golang.org/dl/${GO_LIBRARY}
|
|
|
|
# Extract the downloaded archive
|
|
RUN tar -xvf $GO_LIBRARY -C /usr/local
|
|
|
|
# Set Go environment variables
|
|
ENV PATH="/usr/local/go/bin:${PATH}"
|
|
ENV GOPATH="/go"
|
|
ENV GOBIN="$GOPATH/bin"
|
|
|
|
# Make the directory for Go packages
|
|
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
|
|
|
|
# Create tester user
|
|
RUN groupadd -r tester && useradd -r -g tester tester
|
|
RUN mkdir /home/tester && chown tester:tester /home/tester
|
|
ENV HOME=/home/tester
|
|
|
|
# install bats
|
|
RUN git clone https://github.com/bats-core/bats-core.git && \
|
|
cd bats-core && \
|
|
./install.sh /home/tester
|
|
|
|
# Create a shared venv & install Python deps there
|
|
ENV VENV=/opt/venv
|
|
RUN python3 -m venv "$VENV" \
|
|
&& "$VENV/bin/python" -m pip install --upgrade pip \
|
|
&& "$VENV/bin/pip" install --no-cache-dir awscrt
|
|
|
|
# Make the venv the default Python for all subsequent RUN/CMD/ENTRYPOINT
|
|
ENV PATH="$VENV/bin:${PATH}"
|
|
|
|
USER tester
|
|
COPY --chown=tester:tester . /home/tester
|
|
|
|
# add bats support libraries
|
|
RUN git clone https://github.com/bats-core/bats-support.git && rm -rf /home/tester/tests/bats-support && mv bats-support /home/tester/tests
|
|
RUN git clone https://github.com/ztombol/bats-assert.git && rm -rf /home/tester/tests/bats-assert && mv bats-assert /home/tester/tests
|
|
|
|
WORKDIR /home/tester
|
|
RUN make
|
|
|
|
RUN . $SECRETS_FILE && \
|
|
export AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION AWS_PROFILE && \
|
|
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID --profile $AWS_PROFILE && \
|
|
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY --profile $AWS_PROFILE && \
|
|
aws configure set aws_region $AWS_REGION --profile $AWS_PROFILE
|
|
|
|
RUN mkdir /tmp/gw
|
|
|
|
RUN openssl genpkey -algorithm RSA -out versitygw-docker.pem -pkeyopt rsa_keygen_bits:2048 && \
|
|
openssl req -new -x509 -key versitygw-docker.pem -out cert-docker.pem -days 365 \
|
|
-subj "/C=US/ST=California/L=San Francisco/O=Versity/OU=Software/CN=versity.com"
|
|
|
|
ENV WORKSPACE=.
|
|
ENV VERSITYGW_TEST_ENV=$CONFIG_FILE
|
|
#ENV AWS_REQUEST_CHECKSUM_CALCULATION=WHEN_REQUIRED
|
|
|
|
RUN mkdir log
|
|
|
|
ENTRYPOINT ["tests/run.sh"]
|
|
CMD ["s3api,s3,s3cmd,mc,rest"]
|