1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-10-18 00:50: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:
catborise 2026-09-24 22:41:34 +03:00
parent 58b07d9b2b
commit ba9bc2c3b9
2 changed files with 53 additions and 18 deletions

View file

@ -1,25 +1,58 @@
**/__pycache__ # Git
**/.classpath
**/.dockerignore
**/.env
**/.git **/.git
**/.gitignore **/.gitignore
# Python bytecode & cache
**/__pycache__
**/*.py[cod]
**/*$py.class
**/.pytest_cache
**/.coverage
**/htmlcov
# Virtual environments & environment files
**/venv*
**/.venv*
**/env*
**/.env*
# Local databases and runtime data
**/*.sqlite3*
**/*.log
**/console/cert.pem*
**/dhcpd.*
# IDEs and OS
**/.idea
**/.vscode
**/.vs
**/.DS_Store
**/.classpath
**/.project **/.project
**/.settings **/.settings
**/.toolstarget **/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user **/*.*proj.user
**/*.dbmdl **/*.dbmdl
**/*.jfm **/*.jfm
**/azds.yaml **/.vagrant
**/bin
**/charts # Docker and CI
**/docker-compose* **/.dockerignore
**/Dockerfile* **/Dockerfile*
**/docker-compose*
**/azds.yaml
**/charts
**/secrets.dev.yaml
**/values.dev.yaml
# Node / frontend build leftovers
**/node_modules **/node_modules
**/npm-debug.log **/npm-debug.log
**/obj **/obj
**/secrets.dev.yaml **/bin
**/values.dev.yaml
README.md # Documentation / metadata
README.md
AGENTS.md
CODEBASE_OVERVIEW.md
DEPENDENCY_UPGRADE_PLAN.md

View file

@ -27,18 +27,20 @@ RUN apt-get update -qqy \
libsasl2-modules \ libsasl2-modules \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY . /srv/webvirtcloud
RUN chown -R www-data:www-data /srv/webvirtcloud
# Setup webvirtcloud # Setup webvirtcloud
WORKDIR /srv/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 && \ RUN python3 -m venv venv && \
. venv/bin/activate && \ . venv/bin/activate && \
pip3 install -U pip && \ pip3 install -U pip && \
pip3 install wheel && \ pip3 install wheel && \
pip3 install -r conf/requirements.txt && \ pip3 install -r conf/requirements.txt && \
pip3 cache purge && \ pip3 cache purge
chown -R www-data:www-data /srv/webvirtcloud
# Copy application source
COPY . /srv/webvirtcloud
RUN . venv/bin/activate && \ RUN . venv/bin/activate && \
python3 manage.py makemigrations && \ python3 manage.py makemigrations && \