-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
38 lines (28 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
FROM crowdbotics/cb-django:3.8-slim-buster AS build
# Copy dependency management files and install app packages to /.venv
COPY backend/Pipfile backend/Pipfile.lock /
COPY backend/modules/ /modules/
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
FROM node:18.16-alpine AS rn_web_build
WORKDIR /tmp/web_build
COPY . .
RUN yarn install && yarn run web:build
FROM crowdbotics/cb-django:3.8-slim-buster AS release
ARG SECRET_KEY
# Set Working directory
WORKDIR /opt/webapp
# Add runtime user with respective access permissions
RUN groupadd -r django \
&& useradd -d /opt/webapp -r -g django django \
&& chown django:django -R /opt/webapp
USER django
# Copy virtual env from build stage
COPY --chown=django:django --from=build /.venv /.venv
ENV PATH="/.venv/bin:$PATH"
# Copy app source
COPY --chown=django:django ./backend .
# Copy web build from rn_web_build stage
COPY --chown=django:django --from=rn_web_build /tmp/web_build/backend/web_build ./web_build
# Collect static files and serve app
RUN python3 manage.py collectstatic --no-input
CMD waitress-serve --port=$PORT fletcher_website_43802.wsgi:application