forked from artefactual/archivematica-storage-service
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
112 lines (84 loc) · 2.79 KB
/
Dockerfile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
ARG TARGET=archivematica-storage-service
ARG PYTHON_VERSION=python3
FROM ubuntu:18.04 AS base
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONUNBUFFERED 1
# OS dependencies
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
gettext \
git \
gnupg1 \
libldap2-dev \
libmysqlclient-dev \
libsasl2-dev \
locales \
locales-all \
p7zip-full \
rsync \
unar \
&& rm -rf /var/lib/apt/lists/*
# Set the locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN set -ex \
&& groupadd --gid 333 --system archivematica \
&& useradd --uid 333 --gid 333 --system archivematica
RUN set -ex \
&& internalDirs=' \
/db \
/src/storage_service/assets \
/src/storage_service/locations/fixtures \
/var/archivematica/storage_service \
/var/archivematica/sharedDirectory \
' \
&& mkdir -p $internalDirs \
&& chown -R archivematica:archivematica $internalDirs
COPY requirements/ /src/requirements/
COPY ./install/storage-service.gunicorn-config.py /etc/archivematica/storage-service.gunicorn-config.py
# -----------------------------------------------------------------------------
FROM base AS python2
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python-dev \
&& rm -rf /var/lib/apt/lists/*
RUN set -ex \
&& curl -s https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2.7
RUN pip2 install -q -r /src/requirements/production.txt -r /src/requirements/test.txt
COPY ./ /src/
# -----------------------------------------------------------------------------
FROM base AS python3
RUN set -ex \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
RUN set -ex \
&& curl -s https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3.6 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3 10
RUN pip3 install -q -r /src/requirements/production-py3.txt -r /src/requirements/test-py3.txt
COPY ./ /src/
# -----------------------------------------------------------------------------
FROM ${PYTHON_VERSION} AS archivematica-storage-service
WORKDIR /src/storage_service
USER archivematica
ENV DJANGO_SETTINGS_MODULE storage_service.settings.local
ENV PYTHONPATH /src/storage_service
ENV SS_GUNICORN_BIND 0.0.0.0:8000
ENV SS_GUNICORN_CHDIR /src/storage_service
ENV SS_GUNICORN_ACCESSLOG -
ENV SS_GUNICORN_ERRORLOG -
ENV FORWARDED_ALLOW_IPS *
RUN set -ex \
&& export SS_DB_URL=mysql://ne:ver@min/d \
&& ./manage.py collectstatic --noinput --clear \
&& ./manage.py compilemessages
ENV DJANGO_SETTINGS_MODULE storage_service.settings.production
EXPOSE 8000
ENTRYPOINT ["/usr/local/bin/gunicorn", "--config=/etc/archivematica/storage-service.gunicorn-config.py", "storage_service.wsgi:application"]