Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions .github/workflows/docker_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,55 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: universalscientifictechnologies/dosportal/web
IMAGE_NAME_BASE: universalscientifictechnologies/dosportal

jobs:
build-and-push-image:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- component: backend
dockerfile: backend.Dockerfile
- component: frontend
dockerfile: frontend.Dockerfile

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}-${{ matrix.component }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha

- name: Build and push Docker image (${{ matrix.component }})
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
file: ${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}-${{ matrix.component }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}-${{ matrix.component }}:buildcache,mode=max
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
./data/

data/
static/
staticfiles/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
8 changes: 6 additions & 2 deletions backend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ RUN apk add --no-cache \
WORKDIR /DOSPORTAL
COPY requirements.txt /DOSPORTAL/
RUN pip install --no-cache-dir -r requirements.txt
#COPY . /DOSPORTAL/
#COPY cari7a /usr/local/bin/cari7a

COPY . /DOSPORTAL/

RUN python manage.py collectstatic --noinput --clear || true

EXPOSE 8000

ENTRYPOINT ["python", "manage.py", "runserver", "0.0.0.0:8000"]
90 changes: 90 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
networks:
inet:
driver: bridge
ipam:
config:
- subnet: 10.5.0.0/16
gateway: 10.5.0.1
default:
driver: bridge
ipam:
driver: default

services:
db_dosportal:
image: postgis/postgis
env_file:
- .env
volumes:
- ./data/dosportal/db_pg:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${POSTGRES_DB:-dosportal}
- POSTGRES_USER=${POSTGRES_USER:-dosportal_user}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-dosportal_password}
networks:
inet:
ipv4_address: 10.5.0.5

backend:
image: ${BACKEND_IMAGE:-ghcr.io/universalscientifictechnologies/dosportal-backend:master}
env_file:
- .env
ports:
- "8100:8000"
depends_on:
- db_dosportal
- redis
- minio
networks:
inet:
ipv4_address: 10.5.0.6

worker:
image: ${BACKEND_IMAGE:-ghcr.io/universalscientifictechnologies/dosportal-backend:master}
entrypoint: ["python", "manage.py", "qcluster"]
env_file:
- .env
depends_on:
- backend
- db_dosportal
- redis
networks:
inet:
ipv4_address: 10.5.0.8

redis:
image: redis
depends_on:
- db_dosportal
networks:
inet:
ipv4_address: 10.5.0.7

minio:
image: minio/minio
env_file:
- .env
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-minioadmin}
command: server /data --console-address ":9001"
volumes:
- ./data/minio:/data
networks:
inet:
ipv4_address: 10.5.0.9

frontend:
image: ${FRONTEND_IMAGE:-ghcr.io/universalscientifictechnologies/dosportal-frontend:master}
ports:
- "5173:5173"
environment:
- NODE_ENV=production
depends_on:
- backend
networks:
inet:
ipv4_address: 10.5.0.10