From a53a1e8574ad0d346f01df293a9615b556ea77e0 Mon Sep 17 00:00:00 2001 From: fusawayugo Date: Tue, 14 Jan 2025 15:23:22 +0900 Subject: [PATCH] update Dockerfile to build an image successfully --- Dockerfile | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a392d4f..bacfa72a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,47 @@ FROM node:20 AS front-builder -WORKDIR /usr/src/optuna_dashboard +WORKDIR /usr/src/tslib/storage +ADD ./tslib/storage/package.json /usr/src/tslib/storage/package.json +ADD ./tslib/storage/package-lock.json /usr/src/tslib/storage/package-lock.json +RUN npm install + +WORKDIR /usr/src/tslib/types +ADD ./tslib/types/package.json /usr/src/tslib/types/package.json +ADD ./tslib/types/package-lock.json /usr/src/tslib/types/package-lock.json +RUN npm install + +WORKDIR /usr/src/tslib/react +ADD ./tslib/react/package.json /usr/src/tslib/react/package.json +ADD ./tslib/react/package-lock.json /usr/src/tslib/react/package-lock.json +RUN npm install + +WORKDIR /usr/src/optuna_dashboard ADD ./optuna_dashboard/package.json /usr/src/optuna_dashboard/package.json ADD ./optuna_dashboard/package-lock.json /usr/src/optuna_dashboard/package-lock.json RUN npm install -ADD ./optuna_dashboard/tsconfig.json /usr/src/optuna_dashboard/tsconfig.json -ADD ./optuna_dashboard/webpack.config.js /usr/src/optuna_dashboard/webpack.config.js -ADD ./optuna_dashboard/ts/ /usr/src/optuna_dashboard/ts -RUN mkdir -p /usr/src/optuna_dashboard/public -RUN npm run build:prd +WORKDIR /usr/src/ +ADD ./tslib /usr/src/tslib +RUN make tslib + +WORKDIR /usr/src/optuna_dashboard +ADD ./optuna_dashboard /usr/src/optuna_dashboard +RUN NODE_OPTIONS="--max-old-space-size=4096" npm run build:prd -FROM python:3.12-buster AS python-builder +FROM python:3.12-bookworm AS python-builder WORKDIR /usr/src RUN pip install --upgrade pip setuptools -RUN pip install --progress-bar off PyMySQL[rsa] psycopg2-binary gunicorn optuna-fast-fanova +RUN pip install --progress-bar off PyMySQL[rsa] psycopg2-binary gunicorn ADD ./pyproject.toml /usr/src/pyproject.toml ADD ./optuna_dashboard /usr/src/optuna_dashboard COPY --from=front-builder /usr/src/optuna_dashboard/public/ /usr/src/optuna_dashboard/public/ RUN pip install --progress-bar off . -FROM python:3.11-slim-buster as runner +FROM python:3.12-slim-bookworm as runner -COPY --from=python-builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages +COPY --from=python-builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages COPY --from=python-builder /usr/local/bin/optuna-dashboard /usr/local/bin/optuna-dashboard RUN mkdir /app