diff options
author | Matthew Lemon <y@yulqen.org> | 2024-05-03 12:20:31 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-05-03 12:20:31 +0100 |
commit | c6585bd78982e1d6aadd9188dc80d06152f58c10 (patch) | |
tree | cd709bc92449db5962031d5aaeabfdb3d316b356 /Dockerfile | |
parent | 608fc20a7dd5385332ea5a50d7e814edead595f1 (diff) |
Fix for read-only sqlite file
Diffstat (limited to '')
-rw-r--r-- | Dockerfile | 28 |
1 files changed, 16 insertions, 12 deletions
@@ -1,7 +1,7 @@ # Builder stage -FROM registry.access.redhat.com/ubi9/python-311:1-52.1712567218 AS builder +FROM registry.access.redhat.com/ubi9/python-311:1-52.1712567218 AS builder -# Add application sources with correct permissions for OpenShift +# Add application sources USER 0 COPY . /app RUN mkdir -p /app/static/css /app/static/js /app/static/img @@ -10,7 +10,7 @@ USER 1001 WORKDIR /app -# Install the dependencies +# Install dependencies RUN pip install -U "pip>=24.0.0" && \ pip install -r requirements.txt && \ python manage.py collectstatic --noinput @@ -18,24 +18,28 @@ RUN pip install -U "pip>=24.0.0" && \ # Final stage FROM python:3.11-slim -# Set the working directory +# Set working directory WORKDIR /app -# Copy the built artifacts and required files from the builder stage +# Copy from builder COPY --from=builder /app /app -# Install the required packages in the final stage +# Install packages RUN pip install -r requirements.txt -RUN chown -R 1001:0 /app -# Set the appropriate user +# Copy across db file and set permissions +COPY db.sqlite3 /app/db.sqlite3 +RUN chown 1001:0 /app && \ + chmod 664 /app/db.sqlite3 + +# Set user USER 1001 -# Run database migrations -RUN python manage.py migrate +# Migrate database +RUN python manage.py migrate -# Expose the port on which your Django application will run +# Expose port EXPOSE 8000 -# Run the application using Gunicorn +# Start app CMD ["gunicorn", "ded.wsgi:application", "--bind", "0.0.0.0:8000"] |