diff --git a/images/osmcha-web/Dockerfile b/images/osmcha-web/Dockerfile index 06d38d15..1f861267 100644 --- a/images/osmcha-web/Dockerfile +++ b/images/osmcha-web/Dockerfile @@ -36,19 +36,13 @@ RUN pip3 install git+https://github.com/OpenHistoricalMap/social-core.git@master RUN pip3 install -U requests RUN pip3 install certifi RUN pip3 install django-extensions -# Clone and build the frontend -RUN git clone https://github.com/mapbox/osmcha-frontend.git /app/osmcha-frontend -WORKDIR /app/osmcha-frontend -RUN yarn install -RUN REACT_APP_VERSION=ohm REACT_APP_STACK=PRODUCTION PUBLIC_URL=$OSMCHA_URL npx react-scripts build -RUN cp -R build/*.html ../osmchadjango/frontend/templates/frontend/ -RUN cp -R build/* ../osmchadjango/static/ -RUN cp -R build/static/* ../osmchadjango/static/ -ADD . /app +# Clone and build the frontend +RUN git clone https://github.com/mapbox/osmcha-frontend.git /osmcha-frontend +RUN cd /osmcha-frontend && yarn install RUN echo "alias python=python3" >> ~/.bashrc RUN echo "alias pip=pip3" >> ~/.bashrc COPY ./start.sh . -CMD ./start.sh \ No newline at end of file +CMD ./start.sh diff --git a/images/osmcha-web/start.sh b/images/osmcha-web/start.sh index 9eefc10c..0e396977 100755 --- a/images/osmcha-web/start.sh +++ b/images/osmcha-web/start.sh @@ -1,5 +1,15 @@ #!/usr/bin/env bash -set -e +set -ex + +# Build frontend +cd /osmcha-frontend +REACT_APP_VERSION=ohm REACT_APP_STACK=PRODUCTION PUBLIC_URL=$OSMCHA_URL npx react-scripts build +cp -R build/*.html /app/osmchadjango/frontend/templates/frontend/ +cp -R build/* /app/osmchadjango/static/ +cp -R build/static/* /app/osmchadjango/static/ + +# Start service +cd /app python3 manage.py collectstatic --noinput python3 manage.py migrate python3 manage.py runserver 0.0.0.0:8000