Skip to content

Commit

Permalink
Build frontend inside the docker container to have custom config
Browse files Browse the repository at this point in the history
  • Loading branch information
willemarcel authored Sep 12, 2023
1 parent 4437d4d commit fc33d81
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
23 changes: 15 additions & 8 deletions envs/.env.osmcha.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
OSMCHA_URL='' # URL where OSMCha will be deployed
POSTGRES_DB=osmcha
POSTGRES_USER=postgres
POSTGRES_PASSWORD=1234
Expand All @@ -6,14 +7,20 @@ DJANGO_DEBUG=true
DJANGO_SECRET_KEY=abc
OAUTH_OSM_KEY=xya
OAUTH_OSM_SECRET=xya
DJANGO_ANON_USER_THROTTLE_RATE=30/min
DJANGO_COMMON_USER_THROTTLE_RATE=180/min
DJANGO_NON_STAFF_USER_THROTTLE_RATE=3/min
OAUTH_REDIRECT_URI=http://localhost:8000/oauth-landing.html
OAUTH_REDIRECT_URI=$OSMCHA_URL'/oauth-landing.html'
OSMCHA_FRONTEND_VERSION=oh-pages
DJANGO_ENABLE_CHANGESET_COMMENTS=False
DJANGO_OSM_COMMENTS_API_KEY=""
DJANGO_ENABLE_CHANGESET_COMMENTS=true
REACT_APP_ENABLE_REAL_CHANGESETS=0
REACT_APP_PRODUCTION_API_URL=$OSMCHA_URL'/api/v1'
REACT_APP_OVERPASS_BASE='//overpass-api.openhistoricalmap.org/api/interpreter'
REACT_APP_NOMINATIM_URL='https://nominatim-api.openhistoricalmap.org/search.php'
OSM_SERVER_URL='https://www.openhistoricalmap.org'
REACT_APP_OSM_API=$OSM_SERVER_URL'/api/0.6'
REACT_APP_OSM_URL=$OSM_SERVER_URL
REACT_APP_MAPBOX_ACCESS_TOKEN=''
REACT_APP_DEFAULT_FROM_DATE=5
REACT_APP_DEFAULT_TO_DATE=10
REACT_APP_PAGE_SIZE=25
DJANGO_ROOT=/app
DJANGO_SETTINGS_MODULE=config.settings.local
C_FORCE_ROOT=True
OSMCHA_FRONTEND_VERSION=v0.86.0-production
C_FORCE_ROOT=True
9 changes: 9 additions & 0 deletions images/osmcha-web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ RUN pip3 install -U requests
RUN pip3 install certifi
RUN pip3 install django-extensions
ADD . /app
RUN git clone https://github.com/mapbox/osmcha-frontend.git
WORKDIR ./osmcha-frontend/
RUN yarn install
RUN FRONTEND_VERSION=$(node -e "console.log(require('./package.json').version)")
RUN REACT_APP_VERSION=$FRONTEND_VERSION REACT_APP_STACK=PRODUCTION PUBLIC_URL=$OSMCHA_URL react-scripts build
WORKDIR /app
RUN cp osmcha-frontend/build/* osmchadjango/static
RUN mv osmchadjango/static/*.html osmchadjango/templates/
RUN cp -R osmcha-frontend/build/static/ osmchadjango/static

RUN echo "alias python=python3" >> ~/.bashrc
RUN echo "alias pip=pip3" >> ~/.bashrc
Expand Down
1 change: 0 additions & 1 deletion images/osmcha-web/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -e
python3 manage.py update_frontend
python3 manage.py collectstatic --noinput
python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8000

0 comments on commit fc33d81

Please sign in to comment.