forked from kennethgoodman/Columbia-E4579
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.deploy
39 lines (38 loc) · 1.36 KB
/
Dockerfile.deploy
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
# build
FROM node:18-alpine as build-react
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
ENV NODE_ENV production
ENV REACT_APP_API_SERVICE_URL $REACT_APP_API_SERVICE_URL
COPY ./services/client/package*.json ./
RUN npm install
RUN npm install [email protected]
COPY ./services/client/ .
RUN rm .eslintrc.json
RUN npm run build
# production
FROM nginx:stable-alpine as production
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV FLASK_ENV=production
ENV APP_SETTINGS=src.config.ProductionConfig
WORKDIR /app
RUN apk update && \
apk add --no-cache --virtual build-deps \
openssl-dev libffi-dev gcc python3-dev musl-dev g++ \
postgresql-dev netcat-openbsd
RUN python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools && \
if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi && \
if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/python3 /usr/bin/python; fi && \
rm -r /root/.cache
COPY --from=build-react /app/build /usr/share/nginx/html
COPY ./services/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY ./services/backend/requirements.txt ./
RUN pip install -r requirements.txt
RUN pip install gunicorn
COPY ./services/backend .
CMD gunicorn -b 0.0.0.0:5000 manage:app --daemon && \
sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/conf.d/default.conf && \
nginx -g 'daemon off;'