Add pylint to CI, production CD
This commit is contained in:
32
Dockerfile
32
Dockerfile
@@ -1,10 +1,26 @@
|
||||
FROM python:3.6
|
||||
COPY ./ /access_controller
|
||||
FROM python:3.9 as builder
|
||||
# enchant dependency for sphinx
|
||||
RUN apt-get update && apt-get install -y python-enchant
|
||||
# copy source files
|
||||
WORKDIR /access_controller/
|
||||
RUN pip install -r requirements/prod.txt
|
||||
RUN python manage.py makemigrations
|
||||
COPY ./ /access_controller
|
||||
# dev requirements for building sphinx docs
|
||||
RUN pip install -r requirements/dev.txt -r requirements/prod.txt
|
||||
# build static and documentation files into build/webserver
|
||||
RUN ./manage.py collectstatic --no-input && ./documentation.sh
|
||||
# create production venv to copy to final image
|
||||
# production venv is built here because `cryptography` requires rust which doesn't ship on alpine
|
||||
RUN python -m venv venv && venv/bin/pip install -r requirements/prod.txt
|
||||
# move files necessary to run the app to the build folder (including production venv)
|
||||
RUN mv venv access_controller main manage.py build
|
||||
|
||||
FROM python:3.9-alpine
|
||||
WORKDIR /access_controller/
|
||||
COPY --from=builder ["/access_controller/build", "./"]
|
||||
RUN apk update && apk add postgresql-libs && adduser -D -H -u 5579 actrl && chmod -R -w ./
|
||||
USER actrl
|
||||
EXPOSE 8000
|
||||
COPY start.sh /var/
|
||||
CMD bash /var/start.sh
|
||||
|
||||
|
||||
CMD . venv/bin/activate && \
|
||||
python manage.py migrate && \
|
||||
cp -rT webserver srv && \
|
||||
daphne -b 0.0.0.0 access_controller.asgi:application
|
||||
|
||||
Reference in New Issue
Block a user