fix(docker): optimize backend build with explicit COPY and updated .dockerignore

This commit is contained in:
a2nr 2026-09-05 06:55:43 +07:00
parent 17b645325c
commit 4ed5fd8dc4
2 changed files with 20 additions and 4 deletions

View File

@ -1,8 +1,19 @@
frontend/
velxio/
flowchart/
compiler_worker/
velxio-deployer-firmware/
load-test/
.browser-test/
.pytest_cache/
.git/
__pycache__/
*.pyc
state/
config/
documentation.md
podman-compose.yml
podman-compose.velxio.yml
lms-c-precompiled.tar
.dockerignore

View File

@ -15,11 +15,16 @@ WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Copy backend application code only with non-root ownership
COPY --chown=app:app app.py config.py extensions.py gunicorn.conf.py alembic.ini pytest.ini ./
COPY --chown=app:app routes/ ./routes/
COPY --chown=app:app services/ ./services/
COPY --chown=app:app scripts/ ./scripts/
COPY --chown=app:app migrations/ ./migrations/
COPY --chown=app:app docs/ ./docs/
COPY --chown=app:app help/ ./help/
COPY --chown=app:app compiler/ ./compiler/
# Change ownership to the app user
RUN chown -R app:app /app
USER app
# Expose port 5000