build: update production file in backend remove unnecessary packages and add network configuration
This commit is contained in:
parent
949b62d13f
commit
fcebe49f48
3 changed files with 25 additions and 16 deletions
|
|
@ -1,5 +1,7 @@
|
|||
FROM python:3.8.14-alpine3.16 AS backend
|
||||
|
||||
# set environment variables
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
WORKDIR /code
|
||||
|
|
@ -20,12 +22,7 @@ RUN apk --update --no-cache --virtual .build-deps add \
|
|||
"cargo~=1.60" \
|
||||
"git~=2" \
|
||||
"make~=4.3" \
|
||||
"libffi-dev~=3.4" \
|
||||
"libxml2-dev~=2.9" \
|
||||
"libxslt-dev~=1.1" \
|
||||
"xmlsec-dev~=1.2" \
|
||||
"postgresql13-dev~=13" \
|
||||
"libmaxminddb~=1.6" \
|
||||
&& \
|
||||
pip install -r requirements.txt --compile --no-cache-dir \
|
||||
&& \
|
||||
|
|
@ -45,12 +42,13 @@ COPY plane plane/
|
|||
COPY templates templates/
|
||||
|
||||
COPY gunicorn.config.py ./
|
||||
|
||||
COPY bin/takeoff ./takeoff
|
||||
USER root
|
||||
RUN apk --update --no-cache add "bash~=5.1"
|
||||
COPY ./bin ./bin/
|
||||
USER captain
|
||||
|
||||
# Expose container port and run entry point script
|
||||
EXPOSE 8000
|
||||
|
||||
# ENTRYPOINT [ "./takeoff" ]
|
||||
CMD python manage.py migrate && python manage.py rqworker & exec gunicorn plane.wsgi -k gthread --workers 8 --bind 0.0.0.0:8000 --config gunicorn.config.py --max-requests 10000 --max-requests-jitter 1000 --access-logfile -
|
||||
CMD [ "./bin/takeoff" ]
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ DATABASES = {
|
|||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
||||
"NAME": "plane",
|
||||
"USER": "",
|
||||
"PASSWORD": "",
|
||||
"HOST": "",
|
||||
"USER": os.environ.get('PGUSER'),
|
||||
"PASSWORD": os.environ.get('PGPASSWORD'),
|
||||
"HOST": os.environ.get('PGHOST'),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ CORS_ORIGIN_WHITELIST = [
|
|||
# "http://127.0.0.1:9000"
|
||||
]
|
||||
# Parse database configuration from $DATABASE_URL
|
||||
DATABASES["default"] = dj_database_url.config()
|
||||
# DATABASES["default"] = dj_database_url.config()
|
||||
SITE_ID = 1
|
||||
|
||||
# Enable Connection Pooling (if desired)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue