mirror of
https://github.com/retspen/webvirtcloud
synced 2026-10-18 09:00:07 +00:00
perf(docker): optimize dependency layer caching and update dockerignore
- Copy requirements.txt before application source to leverage Docker layer caching - Expand .dockerignore to exclude local venv, cache files, logs, and .env files
This commit is contained in:
parent
58b07d9b2b
commit
ba9bc2c3b9
2 changed files with 53 additions and 18 deletions
12
Dockerfile
12
Dockerfile
|
|
@ -27,18 +27,20 @@ RUN apt-get update -qqy \
|
|||
libsasl2-modules \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
COPY . /srv/webvirtcloud
|
||||
RUN chown -R www-data:www-data /srv/webvirtcloud
|
||||
|
||||
# Setup webvirtcloud
|
||||
WORKDIR /srv/webvirtcloud
|
||||
|
||||
# Install Python dependencies first to leverage Docker layer caching
|
||||
COPY conf/requirements.txt conf/requirements.txt
|
||||
RUN python3 -m venv venv && \
|
||||
. venv/bin/activate && \
|
||||
pip3 install -U pip && \
|
||||
pip3 install wheel && \
|
||||
pip3 install -r conf/requirements.txt && \
|
||||
pip3 cache purge && \
|
||||
chown -R www-data:www-data /srv/webvirtcloud
|
||||
pip3 cache purge
|
||||
|
||||
# Copy application source
|
||||
COPY . /srv/webvirtcloud
|
||||
|
||||
RUN . venv/bin/activate && \
|
||||
python3 manage.py makemigrations && \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue