Merge branch 'feature/dockerize' into feature/ui_upgrade
This commit is contained in:
commit
a6fa709d52
1 changed files with 34 additions and 32 deletions
64
Dockerfile
64
Dockerfile
|
@ -2,41 +2,43 @@
|
|||
# build ui #
|
||||
############
|
||||
|
||||
FROM node:lts-alpine AS build-ui
|
||||
|
||||
# some dir for our code
|
||||
WORKDIR /app
|
||||
|
||||
# install dependencies
|
||||
COPY ui/package*.json ui/yarn*.lock ./
|
||||
RUN yarn --production=false
|
||||
|
||||
# copy code
|
||||
COPY ui .
|
||||
RUN yarn build
|
||||
|
||||
|
||||
##############
|
||||
# webservice #
|
||||
##############
|
||||
|
||||
FROM antonapetrov/uvicorn-gunicorn:python3.9-alpine3.13 AS production
|
||||
|
||||
RUN set -ex; \
|
||||
# prerequisites
|
||||
apk add --no-cache \
|
||||
libmagic \
|
||||
;
|
||||
FROM node:18.16 AS build-ui
|
||||
|
||||
# env setup
|
||||
WORKDIR /usr/local/src/ovdashboard_ui
|
||||
|
||||
# install ovdashboard_ui dependencies
|
||||
COPY ui/package*.json ui/yarn*.lock ./
|
||||
RUN yarn install --production false
|
||||
|
||||
# copy and build ovdashboard_ui
|
||||
COPY ui ./
|
||||
RUN yarn build --dest /tmp/ovdashboard_ui/html
|
||||
|
||||
###########
|
||||
# web app #
|
||||
###########
|
||||
|
||||
FROM tiangolo/uvicorn-gunicorn:python3.12-slim AS production
|
||||
|
||||
# add prepared ovdashboard_ui
|
||||
COPY --from=build-ui /tmp/ovdashboard_ui /usr/local/share/ovdashboard_ui
|
||||
|
||||
# env setup
|
||||
WORKDIR /usr/local/src/ovdashboard_api
|
||||
ENV \
|
||||
PRODUCTION_MODE="true" \
|
||||
APP_MODULE="ovdashboard_api:app"
|
||||
PORT="8000" \
|
||||
MODULE_NAME="ovdashboard_api.app"
|
||||
EXPOSE 8000
|
||||
|
||||
# install API
|
||||
COPY api /usr/src/ovdashboard_api
|
||||
# install ovdashboard_api
|
||||
COPY api ./
|
||||
RUN set -ex; \
|
||||
pip3 --no-cache-dir install /usr/src/ovdashboard_api;
|
||||
# remove example app
|
||||
rm -rf /app; \
|
||||
\
|
||||
python -m pip --no-cache-dir install ./
|
||||
|
||||
# install UI
|
||||
COPY --from=build-ui /app/dist /html
|
||||
# run as unprivileged user
|
||||
USER nobody
|
||||
|
|
Loading…
Reference in a new issue