-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.python
58 lines (57 loc) · 1.79 KB
/
Dockerfile.python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Note that we do not try too hard to optimize image size
FROM python:2.7.8-slim AS rattic
ARG rattic_uid=1000
ARG rattic_gid=1000
ARG rattic_git_repo
ARG rattic_backup_dir
ARG rattic_release_version
ARG postgresql_version
ENV PYTHONBUFFERED 1
# make user ubuntu
RUN groupadd -g $rattic_gid rattic && \
useradd -u $rattic_uid -g rattic -m rattic
# We install:
# - gnupg and postgresql-client-common to be able to restore a backup
# - git to be able to clone project
# - build-essential and libs to install packages
RUN set -x && \
apt-get update && \
apt-get -y --force-yes install \
gnupg \
postgresql-client-$postgresql_version \
git \
libpq-dev \
libsasl2-dev \
libldap2-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
build-essential
# make needed directories
RUN set -x && \
git clone $rattic_git_repo /opt/rattic && \
(cd /opt/rattic; git checkout $rattic_release_version ) && \
mkdir -p /opt/rattic/static && \
mkdir -p $rattic_backup_dir && \
mkdir -p /home/rattic/.gnupg && \
chmod go-rwx /home/rattic/.gnupg && \
chown -R rattic:rattic /opt/rattic /home/rattic/.gnupg $rattic_backup_dir
# install:
# - gunicorn to serve app
# - jinja2 to create conf files (in an identical manner as ansible)
# - requirements for rattic, using postgressql
RUN set -x && \
pip install gunicorn==19.4.5 && \
pip install Jinja2 && \
pip install -r /opt/rattic/requirements-pgsql.txt
# fix ecdsa==0.13 is the right dependency for paramiko
RUN set -x && \
pip install ecdsa==0.13
COPY rattic-entrypoint.sh /entrypoint.sh
COPY --chown=rattic:rattic rattic-local.cfg /opt/rattic/rattic-local.cfg
RUN set -x && \
chmod +x /entrypoint.sh
WORKDIR /opt/rattic
ENTRYPOINT ["/entrypoint.sh"]
USER rattic:rattic