Skip to content

Commit

Permalink
add dev config to image startup
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Oct 13, 2023
1 parent f68aa34 commit 0317328
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# syntax=docker/dockerfile:experimental

# to build for a development environment, run the following command:
# docker build --build-arg build_env=dev -t coldfront --ssh default . --network=host

FROM python:3.8

ARG build_env=production
ENV BUILD_ENV=$build_env

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
&& apt-get install -y redis redis-server \
Expand Down Expand Up @@ -35,7 +42,8 @@ RUN --mount=type=ssh pip install --upgrade pip && \

COPY . .

# RUN pip install django-redis reportlab==3.6.6 django-debug-toolbar
RUN if [ "${BUILD_ENV}" = "dev" ]; then pip install django-redis reportlab==3.6.6 django-debug-toolbar; fi

RUN pip install ldap3 django_auth_ldap django-author==1.0.2 django-prometheus gunicorn

ENV PYTHONPATH /usr/src/app:/usr/src/app/ifxreport
Expand Down
13 changes: 10 additions & 3 deletions container_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
# This script starts up all django processes that need to run upon startup.
# See https://docs.docker.com/config/containers/multi-service_container/ for more info.


# turn on bash's job control
# set -m

service redis-server start
python ./manage.py qcluster &
python ./manage.py add_scheduled_tasks
python ./manage.py collectstatic --no-input
python ./manage.py collectstatic
# initial_setup does not appear to work as requested.
python ./manage.py initial_setup &

gunicorn coldfront.config.wsgi:application --bind 0.0.0.0:80
if [ "$BUILD_ENV" == 'dev' ]; then
python ./manage.py runserver 0.0.0.0:80 --insecure
echo "opt 1 chosen" > `tty`
else
gunicorn coldfront.config.wsgi:application --bind 0.0.0.0:80
echo "opt 2 chosen" > `tty`
fi

0 comments on commit 0317328

Please sign in to comment.