From 89733f60759a2f0ed832d1f2b98bd11e795be6ee Mon Sep 17 00:00:00 2001 From: RMI78 Date: Sat, 2 Nov 2024 00:51:48 -0400 Subject: [PATCH 1/3] added automatic workflow for push and build to GHCR --- .github/workflows/releases.yml | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/releases.yml diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 0000000..52a414a --- /dev/null +++ b/.github/workflows/releases.yml @@ -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/build-push-action@v6.9.0 + 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/build-push-action@v6.9.0 + with: + context: ./backend/ + push: true + tags: | + ghcr.io/${{ env.lower_actor }}/aperisolve-backend:latest + ghcr.io/${{ env.lower_actor }}/aperisolve-backend:${{ env.RELEASE_VERSION }} + From 81271cedd4e8b9e06f49c51b9bd28f50259d1859 Mon Sep 17 00:00:00 2001 From: RMI78 Date: Sat, 2 Nov 2024 16:24:00 -0400 Subject: [PATCH 2/3] modified Docker compose file according to released images --- docker-compose.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c404cf9..d445040 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: @@ -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: @@ -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 + \ No newline at end of file From d659f40169cc4f50308a9d47068dcd488e8a92f4 Mon Sep 17 00:00:00 2001 From: RMI78 Date: Sat, 2 Nov 2024 17:08:49 -0400 Subject: [PATCH 3/3] updated README --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1bdeb10..fa7cadb 100644 --- a/README.md +++ b/README.md @@ -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).