advent22/Dockerfile

35 lines
658 B
Docker
Raw Normal View History

2023-09-18 18:16:34 +00:00
############
# build ui #
############
2023-09-16 21:57:19 +00:00
2023-09-18 18:16:34 +00:00
FROM node:lts AS build-ui
WORKDIR /usr/local/src/advent22_ui
2023-09-16 21:57:19 +00:00
2023-09-18 18:16:34 +00:00
# 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
2023-09-16 21:57:19 +00:00
ENV \
2023-09-18 18:16:34 +00:00
PRODUCTION_MODE="true" \
APP_MODULE="advent22_api.app:app"
# install api
COPY api .
RUN python -m pip --no-cache-dir install .
2023-09-16 21:57:19 +00:00
2023-09-18 18:16:34 +00:00
# add prebuilt ui
COPY --from=build-ui /tmp/advent22_ui /usr/local/share/advent22_ui
2023-09-16 21:57:19 +00:00