Skip to content

Commit 0ed8dc7

Browse files
Merge pull request #363 from openml/feature/use-single-docker-image-for-all-environments
Feature/use single docker image for all environments
2 parents 1c1ccc9 + 25575e0 commit 0ed8dc7

File tree

7 files changed

+20
-87
lines changed

7 files changed

+20
-87
lines changed

.env

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ TESTING=True
1616

1717
URL_API=http://localhost:8000/api/
1818

19+
1920
# REACT
20-
# React env variables are fixed when building the app.
21+
# React env variables are fixed when building the app - but overwritten when setting up the docker container.
22+
# See docker/entrypoint.sh
2123
# React env variables need to be prefixed with "REACT_APP", otherwise the variables are ignored for
2224
# security reasons.
23-
REACT_APP_URL_SITE_BACKEND=http://localhost:8000/
24-
REACT_APP_URL_API=http://localhost:8000/api/
25-
REACT_APP_URL_ELASTICSEARCH=http://localhost:8000/es/
26-
REACT_APP_ELASTICSEARCH_VERSION_MAYOR=6
27-
REACT_APP_URL_MINIO=http://localhost:8000/data/
28-
FLASK_APP=autoapp.py
29-
FLASK_ENV=development
30-
DATABASE_URI=sqlite:///openml.db
25+
REACT_APP_URL_SITE_BACKEND=<REACT_APP_URL_SITE_BACKEND>
26+
REACT_APP_URL_API=<REACT_APP_URL_API>
27+
REACT_APP_URL_ELASTICSEARCH=<REACT_APP_URL_ELASTICSEARCH>
28+
REACT_APP_ELASTICSEARCH_VERSION_MAYOR=<REACT_APP_ELASTICSEARCH_VERSION_MAYOR>
29+
REACT_APP_URL_MINIO=<REACT_APP_URL_MINIO>

.env.dev

Lines changed: 0 additions & 27 deletions
This file was deleted.

.env.k8s

Lines changed: 0 additions & 24 deletions
This file was deleted.

.env.test

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/release_docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
with:
4040
images: "openml/frontend"
4141
tags: |
42-
type=semver,pattern={{raw}},prefix=dev_
42+
type=semver,pattern={{raw}}
4343
4444
- name: Build and push
4545
id: docker_build

docker/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ ARG environment=.dev
33
COPY ./ /app
44

55
RUN npm install --prefix /app/server/src/client/app
6-
RUN /app/server/src/client/app/node_modules/.bin/env-cmd -f /app/.env${environment} npm run build --prefix /app/server/src/client/app
7-
6+
RUN /app/server/src/client/app/node_modules/.bin/env-cmd -f /app/.env npm run build --prefix /app/server/src/client/app
87

98

109
FROM python:3.11-slim-bookworm
@@ -17,7 +16,6 @@ WORKDIR /app
1716
RUN python -m pip install -r requirements.txt
1817

1918
RUN useradd --create-home unprivileged-user
20-
USER unprivileged-user
2119

2220
COPY --from=build /app/server/src/client/app/build /app/server/src/client/app/build
2321

docker/entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
#!/bin/bash
22

3+
for FILENAME in /app/server/src/client/app/build/static/js/*.js; do
4+
# We expect some paths/urls to contain '/' characters, so we use '*' instead
5+
sed "s*<REACT_APP_URL_SITE_BACKEND>*${REACT_APP_URL_SITE_BACKEND:-http://localhost:8000/}*g" --in-place ${FILENAME}
6+
sed "s*<REACT_APP_URL_API>*${REACT_APP_URL_API:-http://localhost:8000/api/}*g" --in-place ${FILENAME}
7+
sed "s*<REACT_APP_URL_ELASTICSEARCH>*${REACT_APP_URL_ELASTICSEARCH:-http://localhost:8000/es/}*g" --in-place ${FILENAME}
8+
sed "s*<REACT_APP_ELASTICSEARCH_VERSION_MAYOR>*${REACT_APP_ELASTICSEARCH_VERSION_MAYOR:-6}*g" --in-place ${FILENAME}
9+
sed "s*<REACT_APP_URL_MINIO>*${REACT_APP_URL_MINIO:-http://localhost:8000/data/}*g" --in-place ${FILENAME}
10+
done
11+
12+
sudo su unprivileged-user
313
gunicorn -b 0.0.0.0:5000 autoapp:app --chdir /app

0 commit comments

Comments
 (0)