This repository has been archived by the owner on Apr 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
972 additions
and
1,020 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,5 @@ venv.bak/ | |
# mypy | ||
.mypy_cache/ | ||
|
||
# node modules | ||
requirements/node_modules/ | ||
node_modules/ | ||
.vscode | ||
/static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,25 @@ | ||
# NPM build stage | ||
# dep at | ||
# /node_modules -> /node_modules | ||
FROM alpine:3.9 AS npmbuild | ||
RUN apk add --no-cache \ | ||
git \ | ||
nodejs \ | ||
npm | ||
COPY ./requirements/package*.json / | ||
RUN npm install | ||
FROM python:3-alpine | ||
|
||
# Python build stage | ||
# dep at | ||
# /wheels/dev -> /wheels | ||
# /wheels/prod -> /wheels | ||
# /wheels/test -> /wheels | ||
FROM alpine:3.9 AS pybuild | ||
RUN apk add --no-cache \ | ||
g++ \ | ||
git \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
linux-headers \ | ||
mariadb-dev \ | ||
python3-dev | ||
COPY ./requirements/base.txt /requirements/base.txt | ||
COPY ./requirements/dev.txt /requirements/dev.txt | ||
COPY ./requirements/prod.txt /requirements/prod.txt | ||
COPY ./requirements/test.txt /requirements/test.txt | ||
RUN pip3 install wheel | ||
WORKDIR /wheels/dev | ||
RUN pip3 wheel -r /requirements/dev.txt \ | ||
&& pip3 install /wheels/dev/* | ||
WORKDIR /wheels/test | ||
RUN pip3 wheel -r /requirements/test.txt \ | ||
&& pip3 install /wheels/test/* | ||
WORKDIR /wheels/prod | ||
RUN pip3 wheel -r /requirements/prod.txt \ | ||
&& pip3 install /wheels/prod/* | ||
|
||
# Dev | ||
FROM alpine:3.9 AS dev | ||
RUN apk add --no-cache \ | ||
g++ \ | ||
git \ | ||
linux-headers \ | ||
mariadb-dev \ | ||
nodejs \ | ||
python3-dev | ||
WORKDIR /wheels/ | ||
COPY --from=pybuild /wheels/dev/ /wheels/ | ||
RUN ln -s /usr/bin/python3 /usr/bin/python \ | ||
&& pip3 install --no-cache-dir /wheels/* \ | ||
&& rm -rf /wheels | ||
COPY --from=npmbuild /node_modules /node_modules | ||
RUN addgroup -g 1000 factotum && \ | ||
adduser -D -u 1000 -G factotum factotum | ||
USER 1000 | ||
ENTRYPOINT ["python3", "/app/manage.py"] | ||
CMD ["runserver"] | ||
WORKDIR /app | ||
VOLUME /app | ||
EXPOSE 5000 | ||
COPY requirements.txt /requirements.txt | ||
RUN pip3 --no-cache-dir install -r /requirements.txt \ | ||
&& rm /requirements.txt | ||
|
||
# Production | ||
FROM alpine:3.9 AS prod | ||
RUN apk add --no-cache \ | ||
g++ \ | ||
git \ | ||
linux-headers \ | ||
mariadb-dev \ | ||
python3-dev | ||
WORKDIR /wheels | ||
COPY --from=pybuild /wheels/prod /wheels | ||
RUN ln -s /usr/bin/python3 /usr/bin/python \ | ||
&& pip3 install --no-cache-dir /wheels/* \ | ||
&& rm -rf /wheels | ||
COPY . /app/. | ||
ENTRYPOINT ["python3", "/app/manage.py"] | ||
CMD ["runserver"] | ||
WORKDIR /app | ||
RUN rm -rf static \ | ||
&& python3 manage.py collectstatic | ||
|
||
CMD gunicorn config.wsgi -c config/gunicorn.conf --log-config config/logging.conf | ||
|
||
EXPOSE 8001 | ||
VOLUME /app/static | ||
|
Oops, something went wrong.