-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
76 lines (53 loc) · 2.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
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
FROM node:14.15.5-buster-slim AS webpack
LABEL maintainer="Nick Janetakis <[email protected]>"
WORKDIR /app/assets
RUN apt-get update \
&& apt-get install -y build-essential --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \
&& apt-get clean \
&& mkdir -p /node_modules && chown node:node -R /node_modules /app
USER node
COPY --chown=node:node assets/package.json assets/*yarn* ./
RUN yarn install
ARG NODE_ENV="production"
ENV NODE_ENV="${NODE_ENV}" \
USER="node"
COPY --chown=node:node assets .
# We need to copy the main web app so that PurgeCSS can find our HTML templates
# at build time so it knows what to purge / keep in the final CSS bundle.
#
# This doesn't bloat anything in the end because only the final assets get
# copied over in another build stage. Yay for multi-stage builds!
COPY --chown=node:node bitcoinstore /app/bitcoinstore
RUN if [ "${NODE_ENV}" != "development" ]; then \
yarn run build; else mkdir -p /app/public; fi
CMD ["bash"]
#
FROM python:3.9.2-slim-buster AS app
LABEL maintainer="Nick Janetakis <[email protected]>"
WORKDIR /app
RUN apt-get update \
&& apt-get install -y build-essential curl libpq-dev --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* /usr/share/doc /usr/share/man \
&& apt-get clean \
&& useradd --create-home python \
&& chown python:python -R /app
USER python
COPY --chown=python:python requirements*.txt ./
COPY --chown=python:python bin/ ./bin
RUN chmod 0755 bin/* && bin/pip3-install
ARG FLASK_ENV="production"
ENV FLASK_ENV="${FLASK_ENV}" \
FLASK_APP="bitcoinstore.app" \
FLASK_SKIP_DOTENV="true" \
PYTHONUNBUFFERED="true" \
PYTHONPATH="." \
PATH="${PATH}:/home/python/.local/bin" \
USER="python"
COPY --chown=python:python --from=webpack /app/public /public
COPY --chown=python:python . .
RUN if [ "${FLASK_ENV}" != "development" ]; then \
ln -s /public /app/public && flask digest compile && rm -rf /app/public; fi
ENTRYPOINT ["/app/bin/docker-entrypoint-web"]
EXPOSE 8000
CMD ["gunicorn", "-c", "python:config.gunicorn", "bitcoinstore.app:create_app()"]