Предрелизный коммит

This commit is contained in:
za_litvu 2025-06-23 08:45:56 +07:00
parent adec5a2332
commit 3399583c4a
6 changed files with 69 additions and 9 deletions

View File

@ -1 +1 @@
*/local_settings.py
app/local_settings.py

View File

@ -0,0 +1,57 @@
###########
# BUILDER #
###########
# pull official base image
FROM python:3.10 as builder
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc
# install python dependencies
COPY ./requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
#########
# FINAL #
#########
# pull official base image
FROM python:3.10
# create directory for the app user
RUN mkdir -p /home/app
# create the app user
RUN addgroup --system app && adduser --system --group app
# create the appropriate directories
ENV HOME=/home/app
ENV APP_HOME=/home/app/web
RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/static
WORKDIR $APP_HOME
# install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends netcat-traditional
RUN apt-get update && apt-get install -y libgl1-mesa-glx
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache /wheels/*
# copy project
COPY . $APP_HOME
RUN chown -R app:app $APP_HOME
USER app

View File

@ -21,6 +21,9 @@ CHANNEL_LAYERS = {
},
}
MIDDLEWARE = [
"whitenoise.middleware.WhiteNoiseMiddleware",
]
# MIDDLEWARE = [
# "whitenoise.middleware.WhiteNoiseMiddleware",
# ]
# STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

View File

@ -38,8 +38,6 @@ MIDDLEWARE = MIDDLEWARE + [
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
ROOT_URLCONF = 'app.urls'
TEMPLATES = [

View File

@ -1,6 +1,8 @@
uvicorn==0.34.3
django==4.2
dotenv==1.1.0
dotenv
channels==4.2.2
whitenoise==6.9.0
websockets==15.0.1
websockets==15.0.1
psycopg2-binary
django-redis==5.4.0

View File

@ -1,6 +1,6 @@
services:
web:
build: ./app/Dockerfile
build: ./app
container_name: web
command: >
sh -c "python manage.py collectstatic --noinput &&