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