44 lines
858 B
Docker
44 lines
858 B
Docker
############
|
|
# build ui #
|
|
############
|
|
|
|
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" \
|
|
PORT="8000" \
|
|
MODULE_NAME="ovdashboard_api.app"
|
|
EXPOSE 8000
|
|
|
|
# install ovdashboard_api
|
|
COPY api ./
|
|
RUN set -ex; \
|
|
# remove example app
|
|
rm -rf /app; \
|
|
\
|
|
python -m pip --no-cache-dir install ./
|
|
|
|
# run as unprivileged user
|
|
USER nobody
|