Skip to content

Commit

Permalink
update Dockerfile to build an image successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
fusawayugo committed Jan 14, 2025
1 parent 0c08c22 commit a53a1e8
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit a53a1e8

Please sign in to comment.