update compose for monorepo
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 28s

This commit is contained in:
2026-08-02 05:10:30 +05:00
parent c56140011f
commit 4bf75fdfe4
8 changed files with 47 additions and 114 deletions
+13
View File
@@ -0,0 +1,13 @@
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Source is bind-mounted at runtime; (re)install deps on start so
# requirements.txt changes are picked up without a rebuild, then run the
# Django autoreloading dev server.
CMD pip install --no-cache-dir -r requirements.txt \
&& python manage.py migrate \
&& python manage.py runserver 0.0.0.0:5000
-13
View File
@@ -1,13 +0,0 @@
FROM python:3.11.4-slim-buster
WORKDIR /var/www/html/
COPY . .
RUN pip install -r requirements.txt
RUN python3 manage.py collectstatic
VOLUME /var/www/html/staticfiles/
CMD gunicorn apibase.wsgi:application --bind 0.0.0.0:5000 --workers=4
-13
View File
@@ -1,13 +0,0 @@
services:
api:
build:
context: ../../
dockerfile: .build/prod/api.Dockerfile
hostname: sarlink-portal-api
image: git.shihaam.dev/sarlink/sarlink-portal-api/api
nginx:
build:
context: .
dockerfile: ./nginx.Dockerfile
hostname: sarlink-portal-api-nginx
image: git.shihaam.dev/sarlink/sarlink-portal-api/nginx
-14
View File
@@ -1,14 +0,0 @@
#!/bin/sh
if [ "$DATABASE" = "postgres" ]
then
echo "Waiting for postgres..."
while ! nc -z $POSTGRES_HOST $POSTGRES_PORT; do
sleep 0.1
done
echo "PostgreSQL started"
fi
exec "$@"
-11
View File
@@ -1,11 +0,0 @@
FROM nginx
# Install basic tools
RUN apt update \
&& apt install curl nano iputils-ping zip unzip -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
COPY nginx.conf /etc/nginx/conf.d/default.conf
WORKDIR /etc/nginx
-26
View File
@@ -1,26 +0,0 @@
server {
listen 80;
server_name _;
access_log /dev/stdout;
error_log /dev/stdout info;
# Serve static files
location /static/ {
alias /var/www/html/staticfiles/;
}
location /media/ {
alias /var/www/html/media/;
}
# Forward requests to Gunicorn
location / {
proxy_pass http://portal-api:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 6M;
}
}
+34
View File
@@ -0,0 +1,34 @@
services:
backend:
build:
context: .build/dev
hostname: backend
volumes:
- ./:/app
ports:
- 5000:5000
env_file:
- .env
depends_on:
database:
condition: service_healthy
database:
image: postgres:16
hostname: database
environment:
POSTGRES_DB: ${POSTGRES_DATABASE:-sarlink}
POSTGRES_USER: ${POSTGRES_USER:-sarlink}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
volumes:
- pgdata:/var/lib/postgresql/data
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-sarlink}"]
interval: 5s
timeout: 3s
retries: 10
volumes:
pgdata:
-37
View File
@@ -1,37 +0,0 @@
services:
api:
build:
context: .
restart: always
command: gunicorn apibase.wsgi:application --bind 0.0.0.0:5000 --workers=2
volumes:
- /home/<username>/docker/council-api/staticfiles:/home/app/api/staticfiles
ports:
- 5000:5000
env_file:
- ./.env
depends_on:
- db
- redis
db:
image: postgres:15
restart: always
volumes:
- ./postgres_data:/var/lib/postgresql/data/
env_file:
- ./.env
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DATABASE}
ports:
- 5232:5432
redis:
image: "redis:alpine"
restart: always
expose:
- "6379"