mirror of
https://github.com/versity/versitygw.git
synced 2025-12-23 05:05:16 +00:00
82 lines
2.3 KiB
Plaintext
82 lines
2.3 KiB
Plaintext
FROM --platform=linux/arm64 ubuntu:latest
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
ARG SECRETS_FILE=tests/.secrets
|
|
ARG CONFIG_FILE=tests/.env.docker
|
|
|
|
ENV TZ=Etc/UTC
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
git \
|
|
make \
|
|
wget \
|
|
curl \
|
|
unzip \
|
|
tzdata \
|
|
s3cmd \
|
|
jq \
|
|
bc \
|
|
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/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" && unzip awscliv2.zip && ./aws/install
|
|
|
|
# Install mc
|
|
RUN curl https://dl.min.io/client/mc/release/linux-arm64/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/go1.21.7.linux-arm64.tar.gz
|
|
|
|
# Extract the downloaded archive
|
|
RUN tar -xvf go1.21.7.linux-arm64.tar.gz -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
|
|
|
|
USER tester
|
|
COPY --chown=tester:tester . /home/tester
|
|
|
|
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
|
|
|
|
CMD ["tests/run_all.sh"]
|