This repository has been archived on 2021-12-24. You can view files and clone it, but cannot push or open issues/pull-requests.
jos/Dockerfile

54 lines
934 B
Docker
Raw Normal View History

2021-05-18 21:46:17 +02:00
# Build backend wheels
2021-12-24 09:03:00 +01:00
FROM python:3.10 AS builder
2021-05-18 12:15:21 +02:00
WORKDIR /wheels
# Update pip & build the wheels
COPY ./setup.cfg ./
RUN pip wheel -e .
2021-05-18 21:46:17 +02:00
# Build frontend
FROM node:16 AS fbuilder
# Copy source code
WORKDIR /usr/src/app
COPY ./web ./web
COPY Makefile .
# Build frontend
RUN make fbuild
2021-12-24 09:03:00 +01:00
FROM python:3.10-slim
2021-05-18 12:15:21 +02:00
# Switch to non-root user
RUN groupadd -r runner && \
useradd -mrg runner runner
# Install the generated wheels
COPY --from=builder /wheels /wheels
RUN pip install \
--no-cache-dir \
--no-warn-script-location \
-f /wheels \
-e /wheels && \
rm -rf /wheels
# Switch to non-root user
USER runner
# Copy source files
WORKDIR /usr/src/app
COPY --chown=runner:runner ./app ./app
COPY --chown=runner:runner setup.cfg setup.py ./
2021-05-18 21:46:17 +02:00
# Copy frontend build
COPY \
--from=fbuilder \
--chown=runner:runner \
2021-05-18 22:06:37 +02:00
/usr/src/app/web/dist ./web/dist
2021-05-18 21:46:17 +02:00
2021-05-18 12:15:21 +02:00
ENTRYPOINT ["python"]
CMD ["app"]