2022-12-01 13:48:10 +00:00
|
|
|
FROM python:3.8.14-alpine3.16 AS backend
|
|
|
|
|
2022-12-01 17:29:06 +00:00
|
|
|
# set environment variables
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE 1
|
2022-12-01 13:48:10 +00:00
|
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
|
|
|
|
WORKDIR /code
|
|
|
|
|
|
|
|
RUN apk --update --no-cache add \
|
|
|
|
"libpq~=14" \
|
|
|
|
"libxslt~=1.1" \
|
|
|
|
"nodejs-current~=18" \
|
|
|
|
"xmlsec~=1.2"
|
|
|
|
|
|
|
|
|
|
|
|
COPY requirements.txt ./
|
|
|
|
COPY requirements ./requirements
|
|
|
|
RUN apk --update --no-cache --virtual .build-deps add \
|
|
|
|
"bash~=5.1" \
|
|
|
|
"g++~=11.2" \
|
|
|
|
"gcc~=11.2" \
|
|
|
|
"cargo~=1.60" \
|
|
|
|
"git~=2" \
|
|
|
|
"make~=4.3" \
|
|
|
|
"postgresql13-dev~=13" \
|
|
|
|
&& \
|
|
|
|
pip install -r requirements.txt --compile --no-cache-dir \
|
|
|
|
&& \
|
|
|
|
apk del .build-deps
|
|
|
|
|
|
|
|
|
|
|
|
RUN addgroup -S plane && \
|
|
|
|
adduser -S captain -G plane
|
|
|
|
|
|
|
|
RUN chown captain.plane /code
|
|
|
|
|
|
|
|
USER captain
|
|
|
|
|
|
|
|
# Add in Django deps and generate Django's static files
|
|
|
|
COPY manage.py manage.py
|
|
|
|
COPY plane plane/
|
|
|
|
COPY templates templates/
|
|
|
|
|
|
|
|
COPY gunicorn.config.py ./
|
2022-12-01 17:29:06 +00:00
|
|
|
USER root
|
|
|
|
RUN apk --update --no-cache add "bash~=5.1"
|
|
|
|
COPY ./bin ./bin/
|
2022-12-01 13:48:10 +00:00
|
|
|
USER captain
|
|
|
|
|
|
|
|
# Expose container port and run entry point script
|
|
|
|
EXPOSE 8000
|
|
|
|
|
2022-12-01 17:29:06 +00:00
|
|
|
CMD [ "./bin/takeoff" ]
|
|
|
|
|