cleaner dockerization
This commit is contained in:
parent
2d864dd57f
commit
1b71aab5b6
2 changed files with 30 additions and 14 deletions
38
Dockerfile
38
Dockerfile
|
@ -1,18 +1,34 @@
|
|||
FROM node:lts AS uibuild
|
||||
WORKDIR /usr/src/app
|
||||
COPY ui/package*.json ui/yarn*.lock ./
|
||||
RUN yarn --production=false
|
||||
COPY ui ./
|
||||
RUN yarn build
|
||||
############
|
||||
# build ui #
|
||||
############
|
||||
|
||||
FROM tiangolo/uvicorn-gunicorn:python3.11-slim
|
||||
WORKDIR /usr/src/app
|
||||
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"
|
||||
|
||||
COPY api ./
|
||||
RUN python -m pip --no-cache-dir install ./
|
||||
COPY --from=uibuild /usr/src/app/dist /html
|
||||
# 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
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class Settings(BaseSettings):
|
|||
#####
|
||||
|
||||
production_mode: bool = False
|
||||
ui_directory: str = "/html"
|
||||
ui_directory: str = "/usr/local/share/advent22_ui/html"
|
||||
|
||||
#####
|
||||
# openapi settings
|
||||
|
|
Loading…
Reference in a new issue