diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index 299634581ec84b8e44922a00991dfb191f52ec96..aeb41abb1b4c5cddceb01c426f8715e8e60acb54 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -1,28 +1,21 @@ FROM cimg/python:3.9.10-node -# Set work directory +# Set work directory. WORKDIR /usr/local/hypha -# Set environment variables +# Set environment variables. ENV API_BASE_URL http://apply.hypha.test:8090/api ENV DATABASE_URL postgres://hypha:hypha@db:5432/hypha ENV DJANGO_SETTINGS_MODULE hypha.settings.dev ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 -# Prepare for npm -COPY package.json package-lock.json /usr/local/hypha/ - # Set owner on /usr/local. RUN sudo chown -R circleci:circleci /usr/local -USER circleci - -# Install node dependencies. -RUN npm install --global --quiet # Install python dependencies. COPY requirements.txt requirements-dev.txt /usr/local/hypha/ RUN pip3 install --quiet -r requirements-dev.txt -# Run entrypoint.sh +# Run entrypoint.sh. ENTRYPOINT ["/usr/local/hypha/docker/entrypoint.dev.sh"] diff --git a/docker/entrypoint.dev.sh b/docker/entrypoint.dev.sh index 1284aae6cf8af42a71d1a5969b430b680eb7d652..883da8c353d4f37288bb4e29f7f4f0c5625ff975 100755 --- a/docker/entrypoint.dev.sh +++ b/docker/entrypoint.dev.sh @@ -1,13 +1,16 @@ #!/bin/sh -#npm install --quiet +# Install node packages and run build command. +npm install --quiet npm run build -#pip3 install --quiet -r requirements-dev.txt +# Run needed python commands. python3 manage.py createcachetable python3 manage.py collectstatic --noinput --verbosity=0 python3 manage.py migrate python3 manage.py wagtailsiteupdate hypha.test apply.hypha.test 8090 + +# Start gunicorn server. gunicorn hypha.wsgi:application --env DJANGO_SETTINGS_MODULE=hypha.settings.dev --reload --bind 0.0.0.0:9001 exec "$@"