1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-14 10:13:05 +02:00
pgbackrest/test/docker/s3-server.docker

51 lines
2.0 KiB
Docker

# S3 Server used for testing and documentation
# docker build -f s3-server.docker -t pgbackrest/test:s3-server-20180612A .
FROM ubuntu:18.04
# Suppress dpkg interactive output
RUN rm /etc/apt/apt.conf.d/70debconf && \
# Install base packages
apt-get update && \
apt-get -y install build-essential openssl wget git python-pip && \
# Fix root tty
sed -i 's/^mesg n/tty -s \&\& mesg n/g' /root/.profile && \
# Generate fake certs
mkdir -p -m 755 /etc/fake-cert && \
cd /etc/fake-cert && \
openssl genrsa -out ca.key 2048 && \
openssl req -new -x509 -extensions v3_ca -key ca.key -out ca.crt -days 99999 \
-subj "/C=US/ST=Country/L=City/O=Organization/CN=pgbackrest.org" && \
openssl genrsa -out server.key 2048 && \
openssl req -new -key server.key -out server.csr \
-subj "/C=US/ST=Country/L=City/O=Organization/CN=*.pgbackrest.org" && \
openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 99999 \
-sha256 && \
chmod 644 /etc/fake-cert/* && \
# Install AWS CLI
pip install --upgrade awscli && \
aws configure set region us-east-1 && \
aws configure set aws_access_key_id accessKey1 && \
aws configure set aws_secret_access_key verySecretKey1 && \
# Install node.js
wget -O /root/nodejs.sh https://deb.nodesource.com/setup_6.x && \
bash /root/nodejs.sh && \
apt-get install -y nodejs npm && \
# Install Scality S3
wget -O /root/scalitys3.tar.gz https://github.com/scality/S3/archive/GA6.4.2.1.tar.gz && \
mkdir /root/scalitys3 && \
tar -C /root/scalitys3 --strip-components 1 -xvf /root/scalitys3.tar.gz && \
cd /root/scalitys3 && \
npm install && \
sed -i "0,/,/s//,\n \"certFilePaths\":{\"key\":\"\/etc\/fake\-cert\/server.key\",\"cert\":\"\/etc\/fake\-cert\/server.crt\",\"ca\":\"\/etc\/fake\-cert\/ca.crt\"},/" \
./config.json && \
sed -i "s/ort\"\: 8000/ort\"\: 443/" ./config.json
# Start SSH when container starts
ENTRYPOINT npm start --prefix /root/scalitys3