chore: optimize image build

This commit is contained in:
zuk 2024-10-13 20:26:16 +02:00
parent bb510718d2
commit 0d9a175438
2 changed files with 5 additions and 5 deletions

View file

@ -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"]

View file

@ -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"]