mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-12-24 21:43:00 +00:00
39 lines
738 B
Docker
39 lines
738 B
Docker
############
|
|
# build ui #
|
|
############
|
|
|
|
FROM node:lts AS build-ui
|
|
WORKDIR /usr/local/src/advent22_ui
|
|
|
|
# install dependencies
|
|
COPY ui/package*.json ui/yarn*.lock ./
|
|
RUN yarn install --production false
|
|
|
|
# copy and build full ui
|
|
COPY ui ./
|
|
RUN yarn build --dest /tmp/advent22_ui/html
|
|
|
|
###########
|
|
# web app #
|
|
###########
|
|
|
|
FROM tiangolo/uvicorn-gunicorn:python3.11-slim AS production
|
|
WORKDIR /usr/local/src/advent22_api
|
|
|
|
# env setup
|
|
ENV \
|
|
PRODUCTION_MODE="true" \
|
|
MODULE_NAME="advent22_api.app"
|
|
|
|
# install api
|
|
COPY api ./
|
|
RUN set -ex; \
|
|
rm -rf /app; \
|
|
\
|
|
python -m pip --no-cache-dir install ./
|
|
|
|
# add prebuilt ui
|
|
COPY --from=build-ui /tmp/advent22_ui /usr/local/share/advent22_ui
|
|
|
|
# run as unprivileged user
|
|
USER nobody
|