ovdashboard/Dockerfile

54 lines
1.1 KiB
Docker
Raw Normal View History

2022-09-19 22:55:52 +00:00
############
# build ui #
############
2023-11-09 11:40:10 +00:00
ARG NODE_VERSION=lts
ARG PYTHON_VERSION=3.12-slim
FROM node:${NODE_VERSION} AS build-ui
2022-09-19 22:55:52 +00:00
2023-10-26 16:28:00 +00:00
# env setup
WORKDIR /usr/local/src/ovdashboard_ui
2022-09-19 22:55:52 +00:00
2023-10-26 16:28:00 +00:00
# install ovdashboard_ui dependencies
2022-09-19 22:55:52 +00:00
COPY ui/package*.json ui/yarn*.lock ./
2023-10-26 16:28:00 +00:00
RUN yarn install --production false
2022-09-19 22:55:52 +00:00
2023-10-26 16:28:00 +00:00
# copy and build ovdashboard_ui
COPY ui ./
RUN yarn build --dest /tmp/ovdashboard_ui/html
2022-09-19 22:55:52 +00:00
2023-10-26 16:28:00 +00:00
###########
# web app #
###########
2022-09-19 22:55:52 +00:00
2023-11-09 11:40:10 +00:00
ARG PYTHON_VERSION
FROM tiangolo/uvicorn-gunicorn:python${PYTHON_VERSION} AS production
2022-09-19 22:55:52 +00:00
# env setup
2023-10-26 16:28:00 +00:00
WORKDIR /usr/local/src/ovdashboard_api
ENV \
2022-09-19 22:55:52 +00:00
PRODUCTION_MODE="true" \
2023-10-26 16:28:00 +00:00
PORT="8000" \
MODULE_NAME="ovdashboard_api.app"
EXPOSE 8000
2022-09-19 22:55:52 +00:00
2023-10-26 16:28:00 +00:00
COPY api ./
2022-09-19 22:55:52 +00:00
RUN set -ex; \
# install libs
export DEBIAN_FRONTEND=noninteractive; \
apt-get update; apt-get install --yes --no-install-recommends \
libmagic1 \
; rm -rf /var/lib/apt/lists/*; \
\
2023-10-26 16:28:00 +00:00
# remove example app
rm -rf /app; \
\
# install ovdashboard_api
2023-10-26 16:28:00 +00:00
python -m pip --no-cache-dir install ./
2022-09-19 22:55:52 +00:00
2023-11-09 11:40:10 +00:00
# add prepared ovdashboard_ui
COPY --from=build-ui /tmp/ovdashboard_ui /usr/local/share/ovdashboard_ui
2023-10-26 16:28:00 +00:00
# run as unprivileged user
USER nobody