@@ -2,63 +2,42 @@ FROM alpine:3.7
2
2
3
3
MAINTAINER Andy Driver <andy.driver@digital.justice.gov.uk>
4
4
5
- # install build dependencies (they'll be uninstalled after pip install)
6
- RUN apk add --no-cache \
7
- --virtual build-deps \
8
- gcc \
9
- musl-dev
5
+ ENV HELM_VERSION 2.9.1
6
+ ENV HELM_HOME /tmp/helm
7
+ ENV DJANGO_SETTINGS_MODULE "control_panel_api.settings"
10
8
11
- # install python3 and 'ca-certificates' so that HTTPS works consistently
9
+ WORKDIR /home/control-panel
10
+
11
+ # install build dependencies (they'll be uninstalled after pip install)
12
12
RUN apk add --no-cache \
13
+ build-base \
13
14
openssl \
14
15
ca-certificates \
15
16
libffi-dev \
16
- python3-dev
17
-
18
- # Temporary bugfix for libressl
19
- # Postgres needs libressl-dev, but cryptography only works with openssl-dev
20
- RUN apk add --no-cache --virtual temp-ssl-fix \
21
- openssl-dev \
22
- && pip3 install cryptography==2.2.2 \
23
- && apk del temp-ssl-fix \
24
- && apk add --no-cache \
17
+ python3-dev \
25
18
libressl-dev \
26
19
postgresql-dev
27
20
28
- # Install helm
29
- ENV HELM_VERSION 2.9.1
30
- RUN wget https://storage.googleapis.com/kubernetes-helm/helm-v$HELM_VERSION-linux-amd64.tar.gz \
31
- && tar xzf helm-v$HELM_VERSION-linux-amd64.tar.gz \
32
- && mv linux-amd64/helm /usr/local/bin \
33
- && rm -rf helm-v$HELM_VERSION-linux-amd64.tar.gz linux-amd64
34
-
35
- # Configure helm
36
- ENV HELM_HOME /tmp/helm
37
- RUN helm init --client-only
21
+ # Install and configure helm
38
22
COPY helm-repositories.yaml /tmp/helm/repository/repositories.yaml
39
- RUN helm repo update
40
-
41
- WORKDIR /home/control-panel
42
-
43
- # install python dependencies
44
- ADD requirements.txt requirements.txt
45
- RUN pip3 install -r requirements.txt
46
-
47
- # uninstall build dependencies
48
- RUN apk del build-deps
49
-
50
- ENV DJANGO_SETTINGS_MODULE "control_panel_api.settings"
51
-
52
- ADD manage.py manage.py
53
- ADD run_api run_api
54
- ADD run_tests run_tests
55
- ADD wait_for_db wait_for_db
56
- ADD control_panel_api control_panel_api
57
- ADD moj_analytics moj_analytics
23
+ RUN wget https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz -O helm.tgz \
24
+ && tar fxz helm.tgz \
25
+ && mv linux-amd64/helm /usr/local/bin \
26
+ && rm -rf helm.tgz linux-amd64 \
27
+ && helm init --client-only \
28
+ && helm repo update
29
+
30
+ # install python dependencies (and then remove build dependencies)
31
+ COPY requirements.txt ./
32
+ RUN pip3 install -r requirements.txt \
33
+ && apk del build-base
34
+
35
+ COPY control_panel_api control_panel_api
36
+ COPY moj_analytics moj_analytics
37
+ COPY manage.py wait_for_db ./
58
38
59
39
# collect static files for deployment
60
40
RUN python3 manage.py collectstatic
61
41
62
42
EXPOSE 8000
63
-
64
- CMD ["./run_api" ]
43
+ CMD ["gunicorn" , "-b" , "0.0.0.0:8000" , "control_panel_api.wsgi:application" ]
0 commit comments