-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (38 loc) · 889 Bytes
/
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
ARG FLASK_ENV=production
ARG FLASK_APP=api.py
ARG FLASK_PORT=5000
ARG RELOAD=""
ARG user=www-data
ARG group=www-data
FROM catatom2osm4api AS base
LABEL maintainer="[email protected]"
ARG FLASK_ENV
ARG user
ENV APP_PATH=/opt/CatAtomAPI
ENV PYTHONPATH=$PYTHONPATH:$APP_PATH
ENV QT_QPA_PLATFORM=offscreen
ENV XDG_RUNTIME_DIR="/tmp/runtime-$user"
ENV PYTHONUNBUFFERED=1
USER root
WORKDIR $APP_PATH
COPY requisites.txt .
RUN pip install -r requisites.txt
FROM base AS production_stage
ONBUILD COPY . .
FROM base AS development_stage
ONBUILD RUN echo "Skip copy"
FROM ${FLASK_ENV}_stage AS final
ARG user
ARG group
ARG FLASK_PORT
ARG FLASK_APP
ARG RELOAD
ARG HOME=/catastro
ENV FLASK_APP=$FLASK_APP
ENV FLASK_PORT=$FLASK_PORT
ENV RELOAD=$RELOAD
ENV HOME=$HOME
RUN chown -R $user:$group $APP_PATH $XDG_RUNTIME_DIR
EXPOSE $FLASK_PORT
USER $user
CMD [ "python3", "-u", "./api.py" ]