Add Dockerfile

This commit is contained in:
c-bata
2021-10-26 17:21:28 +09:00
parent 8126365fbb
commit 48615ecbf5
2 changed files with 40 additions and 0 deletions
+13
View File
@@ -29,6 +29,19 @@ $ npm run build:prd
</details>
### Building a Docker image
```
$ docker build -t <IMAGE_NAME> .
```
When failed above command due to the out of heap memory error (Exit code: 137), please check "Resources" tab on your Docker engine's preference since it requires a lot of memory to compile TypeScript files.
You can use the Docker image like below:
```
$ docker run -it --rm -p 8080:8080 <IMAGE_NAME> sqlite:///db.sqlite3
```
### Running dashboard server
```
+27
View File
@@ -0,0 +1,27 @@
FROM node:14 AS front-builder
WORKDIR /usr/src
ADD ./package.json /usr/src/package.json
ADD ./package-lock.json /usr/src/package-lock.json
RUN npm install
ADD ./tsconfig.json /usr/src/tsconfig.json
ADD ./webpack.config.js /usr/src/webpack.config.js
ADD ./optuna_dashboard/static/ /usr/src/optuna_dashboard/static
RUN mkdir -p /usr/src/optuna_dashboard/public
RUN npm run build:prd
FROM python:3.8
WORKDIR /usr/src
RUN pip install --upgrade pip setuptools
RUN pip install --no-cache-dir --progress-bar off PyMySQL cryptography psycopg2-binary
ADD ./setup.cfg /usr/src/setup.cfg
ADD ./setup.py /usr/src/setup.py
ADD ./optuna_dashboard /usr/src/optuna_dashboard
COPY --from=front-builder /usr/src/optuna_dashboard/public/ /usr/src/optuna_dashboard/public/
RUN pip install --no-cache-dir --progress-bar off .
EXPOSE 8080
ENTRYPOINT ["optuna-dashboard", "--port", "8080", "--host", "0.0.0.0"]