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:
parent
58b07d9b2b
commit
ba9bc2c3b9
2 changed files with 53 additions and 18 deletions
|
|
@ -1,25 +1,58 @@
|
|||
**/__pycache__
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
# Git
|
||||
**/.git
|
||||
**/.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
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/azds.yaml
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/.vagrant
|
||||
|
||||
# Docker and CI
|
||||
**/.dockerignore
|
||||
**/Dockerfile*
|
||||
**/docker-compose*
|
||||
**/azds.yaml
|
||||
**/charts
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
|
||||
# Node / frontend build leftovers
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
**/bin
|
||||
|
||||
# Documentation / metadata
|
||||
README.md
|
||||
AGENTS.md
|
||||
CODEBASE_OVERVIEW.md
|
||||
DEPENDENCY_UPGRADE_PLAN.md
|
||||
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