Skip to content

Commit

Permalink
Add dockerfiles and compose file
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchrisadams committed May 13, 2024
1 parent fe1744a commit 370696a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 16 deletions.
4 changes: 0 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# ignore everything beginning with dot by default
.*


ansible*

# any local data
Expand All @@ -15,6 +14,3 @@ docs
media
node_modules
staticfiles


!.dockerignore
2 changes: 1 addition & 1 deletion .env.docker.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 17 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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
37 changes: 37 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 370696a

Please sign in to comment.