wip: new Dockerfile

This commit is contained in:
Jörn-Michael Miehe 2023-10-26 18:28:00 +02:00
parent 8609e09067
commit 0372866a98

View file

@ -2,41 +2,43 @@
# build ui # # build ui #
############ ############
FROM node:lts-alpine AS build-ui FROM node:18.16 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 \
;
# env setup # 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 \ ENV \
PRODUCTION_MODE="true" \ PRODUCTION_MODE="true" \
APP_MODULE="ovdashboard_api:app" PORT="8000" \
MODULE_NAME="ovdashboard_api.app"
EXPOSE 8000
# install API # install ovdashboard_api
COPY api /usr/src/ovdashboard_api COPY api ./
RUN set -ex; \ 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 # run as unprivileged user
COPY --from=build-ui /app/dist /html USER nobody