mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
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
|
FROM python:3.8.14-alpine3.16 AS backend
|
||||||
|
|
||||||
|
# set environment variables
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE 1
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
@ -20,12 +22,7 @@ RUN apk --update --no-cache --virtual .build-deps add \
|
|||||||
"cargo~=1.60" \
|
"cargo~=1.60" \
|
||||||
"git~=2" \
|
"git~=2" \
|
||||||
"make~=4.3" \
|
"make~=4.3" \
|
||||||
"libffi-dev~=3.4" \
|
|
||||||
"libxml2-dev~=2.9" \
|
|
||||||
"libxslt-dev~=1.1" \
|
|
||||||
"xmlsec-dev~=1.2" \
|
|
||||||
"postgresql13-dev~=13" \
|
"postgresql13-dev~=13" \
|
||||||
"libmaxminddb~=1.6" \
|
|
||||||
&& \
|
&& \
|
||||||
pip install -r requirements.txt --compile --no-cache-dir \
|
pip install -r requirements.txt --compile --no-cache-dir \
|
||||||
&& \
|
&& \
|
||||||
@ -45,12 +42,13 @@ COPY plane plane/
|
|||||||
COPY templates templates/
|
COPY templates templates/
|
||||||
|
|
||||||
COPY gunicorn.config.py ./
|
COPY gunicorn.config.py ./
|
||||||
|
USER root
|
||||||
COPY bin/takeoff ./takeoff
|
RUN apk --update --no-cache add "bash~=5.1"
|
||||||
|
COPY ./bin ./bin/
|
||||||
USER captain
|
USER captain
|
||||||
|
|
||||||
# Expose container port and run entry point script
|
# Expose container port and run entry point script
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# ENTRYPOINT [ "./takeoff" ]
|
CMD [ "./bin/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 -
|
|
||||||
|
@ -14,9 +14,9 @@ DATABASES = {
|
|||||||
"default": {
|
"default": {
|
||||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
||||||
"NAME": "plane",
|
"NAME": "plane",
|
||||||
"USER": "",
|
"USER": os.environ.get('PGUSER'),
|
||||||
"PASSWORD": "",
|
"PASSWORD": os.environ.get('PGPASSWORD'),
|
||||||
"HOST": "",
|
"HOST": os.environ.get('PGHOST'),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ CORS_ORIGIN_WHITELIST = [
|
|||||||
# "http://127.0.0.1:9000"
|
# "http://127.0.0.1:9000"
|
||||||
]
|
]
|
||||||
# Parse database configuration from $DATABASE_URL
|
# Parse database configuration from $DATABASE_URL
|
||||||
DATABASES["default"] = dj_database_url.config()
|
# DATABASES["default"] = dj_database_url.config()
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
|
|
||||||
# Enable Connection Pooling (if desired)
|
# Enable Connection Pooling (if desired)
|
||||||
|
@ -11,10 +11,14 @@ services:
|
|||||||
POSTGRES_DB: plane
|
POSTGRES_DB: plane
|
||||||
POSTGRES_PASSWORD: plane
|
POSTGRES_PASSWORD: plane
|
||||||
command: postgres -c 'max_connections=1000'
|
command: postgres -c 'max_connections=1000'
|
||||||
|
networks:
|
||||||
|
- app_network
|
||||||
redis:
|
redis:
|
||||||
image: redis:6.2.7-alpine
|
image: redis:6.2.7-alpine
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
command: redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb
|
command: redis-server --maxmemory-policy allkeys-lru --maxmemory 200mb
|
||||||
|
networks:
|
||||||
|
- app_network
|
||||||
plane_web:
|
plane_web:
|
||||||
container_name: plane_web
|
container_name: plane_web
|
||||||
build:
|
build:
|
||||||
@ -37,15 +41,22 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
SENTRY_DSN: $SENTRY_DSN
|
SENTRY_DSN: $SENTRY_DSN
|
||||||
WEB_URL: $WEB_URL
|
WEB_URL: $WEB_URL
|
||||||
DATABASE_URL: postgres://plane:plane@db/plane
|
PGUSER: plane
|
||||||
REDIS_URL: redis://redis
|
PGPASSWORD: plane
|
||||||
|
PGHOST: db
|
||||||
|
REDIS_URL: 'redis://redis:6379/'
|
||||||
|
REDIS_HOST: redis
|
||||||
|
REDIS_PORT: 6379
|
||||||
SECRET_KEY: $SECRET_KEY
|
SECRET_KEY: $SECRET_KEY
|
||||||
networks:
|
networks:
|
||||||
- app_network
|
- app_network
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- redis
|
- 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:
|
networks:
|
||||||
app_network:
|
app_network:
|
||||||
external: true
|
external: true
|
||||||
|
Loading…
Reference in New Issue
Block a user