Skip to content

Commit

Permalink
Merge pull request #59 from RMI78/images_deployment
Browse files Browse the repository at this point in the history
added automatic workflow for push and build to GHCR
  • Loading branch information
Zeecka authored Nov 2, 2024
2 parents eba53c4 + d659f40 commit c55c416
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 11 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Docker Image CI

on:
push:
tags:
- '*'

jobs:

docker-releases-web:

runs-on: ubuntu-latest
steps:
- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: downcase username
run: echo "lower_actor=${GITHUB_ACTOR,,}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker images
uses: docker/[email protected]
with:
context: ./web/
push: true
tags: |
ghcr.io/${{ env.lower_actor }}/aperisolve-web:latest
ghcr.io/${{ env.lower_actor }}/aperisolve-web:${{ env.RELEASE_VERSION }}
docker-releases-backend:

runs-on: ubuntu-latest
steps:
- name: Get release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: downcase username
run: echo "lower_actor=${GITHUB_ACTOR,,}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker images
uses: docker/[email protected]
with:
context: ./backend/
push: true
tags: |
ghcr.io/${{ env.lower_actor }}/aperisolve-backend:latest
ghcr.io/${{ env.lower_actor }}/aperisolve-backend:${{ env.RELEASE_VERSION }}
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@ Both of the two part has its own docker container.

# VI . Run with Docker-Compose

Simply run the following command:
You can pull all the images from the GitHub Container Registry. A simple docker compose file is included in the repos. Just use:
```bash
docker-compose build
docker-compose up
docker compose -f docker-compose.yml up
```

Then check your browser at [http://localhost:5000/](http://localhost:5000).
Expand Down
18 changes: 10 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
services:
web:
build: web
restart: always
image: ghcr.io/zeecka/aperisolve-web:v2.2
container_name: aperisolve_web
volumes:
- ./web:/app
- aperisolve-data:/app/static/uploads
ports:
- "5000:5000"
env_file:
Expand All @@ -15,12 +14,10 @@ services:
- frontend
- backend
backend:
build: backend
restart: always
image: ghcr.io/zeecka/aperisolve-backend:v2.2
container_name: aperisolve_back
volumes:
- ./backend:/app
- ./web/static/uploads:/app/uploads
- aperisolve-data:/app/uploads
env_file:
- .env
depends_on:
Expand All @@ -35,12 +32,17 @@ services:
env_file:
- .env
volumes:
- ./mongo/data:/data/db
- aperisolve-db:/data/db
- ./mongo/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
networks:
- backend

networks:
frontend:
driver: bridge
backend:
driver: bridge
volumes:
aperisolve-data: # All uploads will be stored in this volume
aperisolve-db: # All mongo db related data will be stored in this volume

0 comments on commit c55c416

Please sign in to comment.