From 0d9a1754384c4012ba486fccc33cc43ca41f1ed4 Mon Sep 17 00:00:00 2001 From: Andrea Zucchelli Date: Sun, 13 Oct 2024 20:26:16 +0200 Subject: [PATCH] chore: optimize image build --- Containerfile | 6 +++--- Containerfile-worker | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Containerfile b/Containerfile index d1e06ec..baad04c 100644 --- a/Containerfile +++ b/Containerfile @@ -1,6 +1,7 @@ FROM docker.io/python:slim RUN bash -c 'mkdir /app;\ - python -m venv /venv' + python -m venv /venv;\ + /venv/bin/pip install -r requirements.txt; ' COPY static /app/static COPY templates /app/templates COPY wg_manager /app/wg_manager @@ -8,8 +9,7 @@ COPY wg_connection_manager /app/wg_connection_manager COPY requirements.txt .env manage.py /app/ WORKDIR /app -RUN bash -c '/venv/bin/pip install -r requirements.txt; \ - /venv/bin/python manage.py migrate ; \ +RUN bash -c '/venv/bin/python manage.py migrate ; \ /venv/bin/python manage.py collectstatic --noinput' EXPOSE 4000 CMD ["/venv/bin/gunicorn","wg_manager.wsgi","-b0.0.0.0:4000"] \ No newline at end of file diff --git a/Containerfile-worker b/Containerfile-worker index 847afac..94c00b3 100644 --- a/Containerfile-worker +++ b/Containerfile-worker @@ -1,9 +1,9 @@ FROM docker.io/python:slim RUN bash -c 'mkdir /app;\ - python -m venv /venv' + python -m venv /venv\ + /venv/bin/pip install -r requirements-worker.txt' COPY wg_manager /app/wg_manager COPY wg_connection_manager_worker /app/wg_connection_manager_worker COPY requirements-worker.txt .env /app/ WORKDIR /app -RUN bash -c '/venv/bin/pip install -r requirements-worker.txt' CMD ["/venv/bin/celery","-A","wg_connection_manager_worker.tasks","worker","--loglevel=INFO"] \ No newline at end of file