diff --git a/.dockerignore b/.dockerignore index 153c9626..65c2d395 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,7 +2,6 @@ # ignore everything beginning with dot by default .* - ansible* # any local data @@ -15,6 +14,3 @@ docs media node_modules staticfiles - - -!.dockerignore diff --git a/.env.docker.sample b/.env.docker.sample index 996f72aa..451813b3 100644 --- a/.env.docker.sample +++ b/.env.docker.sample @@ -45,7 +45,7 @@ AMAZON_PROVIDER_ID=697 AMAZON_REMOTE_API_ENDPOINT="https://ip-ranges.amazonaws.com/ip-ranges.json" GOOGLE_PROVIDER_ID=597 -GOOGLE_DATASET_ENDPOINT="https://www.gstatic.com/ipranges/cloud.json"7 +GOOGLE_DATASET_ENDPOINT="https://www.gstatic.com/ipranges/cloud.json" # ; used to allow for convenient access to the aws cli diff --git a/Dockerfile b/Dockerfile index 49bf6cda..b6fb9e6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,14 @@ FROM python:3.11 as production + +RUN apt-get update +RUN apt-get upgrade --yes +RUN apt-get install wget --no-install-recommends --yes +RUN wget https://deb.nodesource.com/setup_18.x -O /tmp/setup_18.x.sh --no-check-certificate +RUN bash /tmp/setup_18.x.sh +RUN apt-get install nodejs --no-install-recommends --yes + + # Install dependencies in a virtualenv ENV VIRTUAL_ENV=/app/.venv @@ -30,9 +39,6 @@ ENV PATH=$VIRTUAL_ENV/bin:$PATH \ # server (Gunicorn). Heroku will ignore this. EXPOSE 9000 -# Don't use the root user as it's an anti-pattern and Heroku does not run -# containers as root either. -# https://devcenter.heroku.com/articles/container-registry-and-runtime#dockerfile-commands-and-runtime USER deploy # Install your app's Python requirements. @@ -43,19 +49,19 @@ RUN python -m pip install uv wheel --upgrade # Copy application code. COPY --chown=deploy . . + # install dependencies via UV RUN uv pip install -r requirements/requirements.linux.generated.txt - # set up front end pipeline -RUN python./manage.py tailwind install -RUN python./manage.py tailwind build +RUN python ./manage.py tailwind install +RUN python ./manage.py tailwind build -# run npx rollup in correct directory +# # # run npx rollup in correct directory RUN cd ./apps/theme/static_src/ && \ npx rollup --config -# TODO Collect static. This command will move static files from application -# directories and "static_compiled" folder to the main static directory that -# will be served by the WSGI server. -# RUN SECRET_KEY=none python manage.py collectstatic --noinput --clear +# # TODO Collect static. This command will move static files from application +# # directories and "static_compiled" folder to the main static directory that +# # will be served by the WSGI server. +RUN python ./manage.py collectstatic --noinput --clear diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..1e2e06d3 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,37 @@ + +services: + db: + image: mariadb:10.11 + restart: always + environment: + - MYSQL_ROOT_PASSWORD=deploy + - MYSQL_DATABASE=greencheck + - MYSQL_USER=deploy + - MYSQL_PASSWORD=deploy + expose: + - 3306 + rabbitmq: + image: rabbitmq:3.11 + restart: always + expose: + - 5672 + ports: + - 5672:5672 + django: + env_file: + - path: ./.env.docker + build: + context: . + dockerfile: Dockerfile + container_name: greenweb-app + image: greenweb-app + expose: + - 9000 + ports: + - 9000:9000 + volumes: + - ./apps:/app/apps + - ./greenweb:/app/greenweb + restart: always + depends_on: + - db