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