diff options
author | Matthew Lemon <y@yulqen.org> | 2024-05-23 17:38:21 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-05-23 17:38:21 +0100 |
commit | ece11ce6b0bf699bffdf66d7e9474351f8d28d35 (patch) | |
tree | cd1d898036cef23c79e948a5bb7bb259ec1491dd | |
parent | de94a3dbf07c0e82ba3eaad21d3f968e55ca1c17 (diff) |
Trying with a RHEL ubi image to get round CVEs
-rw-r--r-- | Dockerfile | 36 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | requirements.txt | 1 |
3 files changed, 26 insertions, 17 deletions
@@ -1,26 +1,34 @@ # Builder stage #FROM registry.access.redhat.com/ubi9/python-311:1-52.1712567218 AS builder -FROM registry.access.redhat.com/ubi9/python-312 - -# Add application sources -USER 0 -COPY . /app -RUN mkdir -p /app/static/css /app/static/js /app/static/img -RUN chown -R 1001:0 /app -USER 1001 +#FROM registry.access.redhat.com/ubi9/python-312 +FROM registry.access.redhat.com/ubi9/ubi-minimal +RUN microdnf install -y \ + gcc \ + python3.12 \ + python3.12-devel \ + python3.12-pip \ + postgresql-devel \ + tzdata \ + && microdnf clean all WORKDIR /app -ENV DJANGO_SETTINGS_MODULE=conf.settings.base +#COPY ./requirements.txt . +COPY . . -# Install dependencies -RUN pip install -U "pip>=24.0.0" && \ - pip install -r requirements.txt && \ - python manage.py collectstatic --noinput +# # Add application sources +# USER 0 +# COPY . /app +# RUN mkdir -p /app/static/css /app/static/js /app/static/img +# RUN chown -R 1001:0 /app +# USER 1001 -ENV DJANGO_SETTINGS_MODULE=conf.settings.local + +# Install dependencies +RUN python3.12 -m pip install -r requirements.txt EXPOSE 8000 # Start app CMD ["gunicorn", "ded.wsgi:application", "--bind", "0.0.0.0:8000"] + @@ -1,4 +1,4 @@ -all: stop create-network build-postgres run-postgres build-django run-django migrate-and-superuser +all: stop create-network build-postgres run-postgres build-django run-django CONFIG := conf.settings.local @@ -19,8 +19,8 @@ build-postgres: run-postgres: docker run -it --name postgres -d --rm -e POSTGRESQL_PASSWORD=ded -e POSTGRESQL_USER=ded -e POSTGRESQL_DATABASE=ded -p 5432:5432 --network dednetwork dso-quay-registry-quay-quay-enterprise.apps.ocp1.azure.dso.digital.mod.uk/defnucsyr-dev-team-a/postgresql:v1.0.0 run-django: - docker run -it --name ded-web -d -e DJANGO_SETTINGS_MODULE=$(CONFIG) -p 8000:8000 --network dednetwork --rm ded-web:latest + docker run -it -d --name ded-web -e DJANGO_SETTINGS_MODULE=$(CONFIG) -p 8000:8000 --network dednetwork --rm ded-web:latest test: python manage.py test migrate-and-superuser: - docker exec -it ded-web sh -c "python manage.py migrate && python manage.py createsuperuser" + docker exec -it ded-web sh -c "python3.12 manage.py migrate && python3.12 manage.py createsuperuser" diff --git a/requirements.txt b/requirements.txt index 9d62c5a..1152c83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ django-crispy-forms django-htmx==1.17.3 gunicorn==22.0.0 psycopg2==2.9.9 +tzdata==2024.1 |