-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (33 loc) · 1.1 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
FROM python:3.5-slim-stretch
# Install build essentials
RUN set -x && \
pip3 install --upgrade pip setuptools && \
find / -name '*.py[co]' -delete
# Add and install project requirements file
COPY requirements.txt /tmp/web-requirements.txt
RUN set -x && \
pip install --no-cache-dir -r /tmp/web-requirements.txt && \
find / -name '*.py[co]' -delete
# Set enviromental variable for my predictionsapp
ENV APP_DIR=/service/project \
PROJECT_DIR=/service \
HTTP_SOCKET=0.0.0.0 \
DEEVIO_USER=deevio \
DEEVIO_GROUP=deevio
# Create non root user and groups.
RUN set -x && \
groupadd --system --gid 1000 $DEEVIO_GROUP && \
useradd --system --gid $DEEVIO_GROUP --uid 1000 -m $DEEVIO_USER
# Add source code
COPY . /service
# Link ctl.sh to /usr/local/bin
RUN ln -s $PROJECT_DIR/ctl.sh /usr/local/bin/app-ctl
# Switch working directory to source code.
WORKDIR $APP_DIR
# Pass version name and date during build, and persist in the img as env vars.
ARG BUILD_VERSION
ARG BUILD_SHA
ARG BUILD_DATE
ENV BUILD_VERSION=$BUILD_VERSION \
BUILD_SHA=$BUILD_SHA \
BUILD_DATE=$BUILD_DATE