forked from github/plane
build: update production file in backend remove unnecessary packages and add network configuration
This commit is contained in:
parent
949b62d13f
commit
fcebe49f48
@ -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)
|
||||
|
@ -11,10 +11,14 @@ services:
|
||||
POSTGRES_DB: plane
|
||||
POSTGRES_PASSWORD: plane
|
||||
command: postgres -c 'max_connections=1000'
|
||||
networks:
|
||||
- app_network
|
||||
redis:
|
||||
image: redis:6.2.7-alpine
|
||||
restart: on-failure
|
||||
command: redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb
|
||||
networks:
|
||||
- app_network
|
||||
plane_web:
|
||||
container_name: plane_web
|
||||
build:
|
||||
@ -37,15 +41,22 @@ services:
|
||||
environment:
|
||||
SENTRY_DSN: $SENTRY_DSN
|
||||
WEB_URL: $WEB_URL
|
||||
DATABASE_URL: postgres://plane:plane@db/plane
|
||||
REDIS_URL: redis://redis
|
||||
PGUSER: plane
|
||||
PGPASSWORD: plane
|
||||
PGHOST: db
|
||||
REDIS_URL: 'redis://redis:6379/'
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
SECRET_KEY: $SECRET_KEY
|
||||
networks:
|
||||
- app_network
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
command: python manage.py migrate && 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 -
|
||||
command: ./bin/takeoff
|
||||
links:
|
||||
- db
|
||||
- redis
|
||||
networks:
|
||||
app_network:
|
||||
external: true
|
||||
|
Loading…
Reference in New Issue
Block a user