Skip to content

Commit fe3663b

Browse files
committed
Merge branch 'develop' into 382-postgresql-crash-workaround
2 parents e8a04d8 + 4161ecc commit fe3663b

28 files changed

+160
-239
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
server/.gitignore
2+
server/Dockerfile
3+
server/entrypoint.sh
Lines changed: 16 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: "Containers: Publish"
22

33
on:
4-
push:
5-
tags: ["v*"]
4+
release:
5+
types: [published]
66

77
permissions:
88
packages: write
@@ -12,10 +12,10 @@ jobs:
1212
name: Build and Push
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v5
1616

1717
- name: Login to ghcr.io Docker registry
18-
uses: docker/login-action@v2
18+
uses: docker/login-action@v3
1919
with:
2020
registry: ghcr.io
2121
username: ${{ github.repository_owner }}
@@ -34,36 +34,20 @@ jobs:
3434
# - name: 'Pull previous Docker container image: :latest'
3535
# run: docker pull "${DOCKER_REPOSITORY}:latest" || true
3636

37-
- name: "Pull previous Docker container image: frontend-static:latest"
38-
run: docker pull "${DOCKER_REPOSITORY}/frontend-static:latest" || true
37+
- name: "Pull previous Docker container image: app:latest"
38+
run: docker pull "${DOCKER_REPOSITORY}/app:latest" || true
3939

40-
- name: "Build Docker container image: frontend-static:latest"
40+
- name: "Build Docker container image: app:latest"
4141
run: |
4242
docker build \
43-
--cache-from "${DOCKER_REPOSITORY}/frontend-static:latest" \
44-
--file frontend/Dockerfile.demo \
45-
--build-arg SERVER_NAME=localhost \
46-
--tag "${DOCKER_REPOSITORY}/frontend-static:latest" \
47-
--tag "${DOCKER_REPOSITORY}/frontend-static:${DOCKER_TAG}" \
48-
frontend
49-
- name: "Push Docker container image frontend-static:latest"
50-
run: docker push "${DOCKER_REPOSITORY}/frontend-static:latest"
43+
--cache-from "${DOCKER_REPOSITORY}/app:latest" \
44+
--file Dockerfile.prod \
45+
--tag "${DOCKER_REPOSITORY}/app:latest" \
46+
--tag "${DOCKER_REPOSITORY}/app:${DOCKER_TAG}" \
47+
.
5148
52-
- name: "Push Docker container image frontend-static:v*"
53-
run: docker push "${DOCKER_REPOSITORY}/frontend-static:${DOCKER_TAG}"
54-
#
55-
#
56-
# - name: 'Build Docker container image: backend:latest'
57-
# run: |
58-
# cd backend && \
59-
# make && \
60-
# docker image tag "${DOCKER_REPOSITORY}/backend/local:latest" "${DOCKER_REPOSITORY}/backend:latest"
61-
#
62-
# - name: Push Docker container image backend:latest
63-
# run: docker push "${DOCKER_REPOSITORY}/backend:latest"
64-
#
65-
# - name: Push Docker container image backend:v*
66-
# run: docker push "${DOCKER_REPOSITORY}/backend:${DOCKER_TAG}"
49+
- name: "Push Docker container image app:latest"
50+
run: docker push "${DOCKER_REPOSITORY}/app:latest"
6751

68-
# - name: Push Docker container image :v*"
69-
# run: docker push "${DOCKER_REPOSITORY}:${DOCKER_TAG}"
52+
- name: "Push Docker container image app:v*"
53+
run: docker push "${DOCKER_REPOSITORY}/app:${DOCKER_TAG}"

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
config/*
2-
.idea/
3-
env*
1+
config/env/*
2+
!config/env/*.example
3+
.idea/

Dockerfile.prod

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Multi-stage Dockerfile for Balancer Application
2+
# Produces a single image with Django backend serving the React frontend
3+
4+
# Stage 1: Build Frontend
5+
FROM node:18 AS frontend-builder
6+
7+
WORKDIR /frontend
8+
9+
# Copy frontend package files
10+
COPY frontend/package*.json ./
11+
12+
# Install dependencies
13+
RUN npm ci --legacy-peer-deps
14+
15+
# Copy frontend source
16+
COPY frontend/ ./
17+
18+
# Build frontend - outputs to dist/ as configured in vite.config.ts
19+
RUN npm run build
20+
21+
# Stage 2: Build Backend
22+
FROM python:3.11.4-slim-bullseye
23+
24+
# Set work directory
25+
WORKDIR /usr/src/app
26+
27+
# Set environment variables
28+
ENV PYTHONDONTWRITEBYTECODE=1
29+
ENV PYTHONUNBUFFERED=1
30+
31+
# Install system dependencies
32+
RUN apt-get update && apt-get install -y netcat && rm -rf /var/lib/apt/lists/*
33+
34+
# Install Python dependencies
35+
RUN pip install --upgrade pip
36+
COPY server/requirements.txt .
37+
RUN pip install -r requirements.txt
38+
39+
# Copy backend application code
40+
COPY server/ .
41+
42+
# Copy frontend build from frontend-builder stage to where Django expects it
43+
COPY --from=frontend-builder /frontend/dist ./build
44+
45+
# Expose port
46+
EXPOSE 8000
47+
48+
# Run entrypoint
49+
ENTRYPOINT ["./entrypoint.prod.sh"]
50+
51+
# Start gunicorn
52+
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000", "--noreload"]

config/env/.env.prod.db

Lines changed: 0 additions & 3 deletions
This file was deleted.

config/env/env.dev renamed to config/env/dev.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ OPENAI_API_KEY=
1313
ANTHROPIC_API_KEY=
1414
PINECONE_API_KEY=
1515
EMAIL_HOST_USER=
16-
EMAIL_HOST_PASSWORD=
16+
EMAIL_HOST_PASSWORD=

config/env/env.prod.db

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
DEBUG=0
22
SECRET_KEY=change_this
33
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]
4-
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]
54
SQL_ENGINE=django.db.backends.postgresql
65
SQL_DATABASE=balancer_prod
76
SQL_USER=set_me
@@ -10,5 +9,8 @@ SQL_HOST=db
109
SQL_PORT=5432
1110
DATABASE=postgres
1211
LOGIN_REDIRECT_URL=
12+
OPENAI_API_KEY=
13+
ANTHROPIC_API_KEY=
14+
PINECONE_API_KEY=
1315
EMAIL_HOST_USER=
14-
EMAIL_HOST_PASSWORD=
16+
EMAIL_HOST_PASSWORD=
File renamed without changes.

deploy/manifests/balancer/base/configmap.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)