Skip to content

Commit

Permalink
Merge pull request #45 from thisisankit27/pre-deploy1
Browse files Browse the repository at this point in the history
Optimize Dockerfile to leverage layer caching for dependency installation
  • Loading branch information
thisisankit27 authored Feb 25, 2024
2 parents ca9cdbe + 2c0aea9 commit e2d53f0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions MasterProject/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ FROM python:3.10.13-slim

ENV PYTHONBUFFERED=1

COPY . /django
WORKDIR /django

COPY requirements.txt requirements.txt

RUN python3 -m venv /opt/venv

RUN /opt/venv/bin/pip install --upgrade pip && \
/opt/venv/bin/pip install -r requirements.txt && \
apt-get update && \
apt-get install -y tesseract-ocr
/opt/venv/bin/pip install -r requirements.txt

COPY . /django

RUN /opt/venv/bin/python manage.py collectstatic --noinput
RUN apt-get update && \
apt-get install -y tesseract-ocr && \
/opt/venv/bin/python manage.py collectstatic --noinput

RUN chmod +x docker-entrypoint.sh

CMD ["/django/docker-entrypoint.sh"]
EXPOSE 8000

EXPOSE 8000
CMD ["/django/docker-entrypoint.sh"]

0 comments on commit e2d53f0

Please sign in to comment.