advent22/Dockerfile

34 lines
658 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" \
APP_MODULE="advent22_api.app:app"
# install api
COPY api .
RUN python -m pip --no-cache-dir install .
# add prebuilt ui
COPY --from=build-ui /tmp/advent22_ui /usr/local/share/advent22_ui