Skip to content

Commit

Permalink
Merge pull request #2 from briefercloud/multiple-images
Browse files Browse the repository at this point in the history
Build and push multiple images to add them to docker-compose.yaml
  • Loading branch information
vieiralucas authored Sep 9, 2024
2 parents 0a75e8a + 62b1035 commit 1d13c69
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
65 changes: 64 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
contents: read

jobs:
docker-image:
docker-monolith-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
Expand Down Expand Up @@ -58,3 +58,66 @@ jobs:
context: .
file: docker/Dockerfile
tags: briefercloud/briefer:${{ github.ref_name }},briefercloud/briefer:latest

docker-multiple-images:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: 'web'
dockerfile: 'apps/web/Dockerfile'
context: '.'
- name: 'api'
dockerfile: 'apps/api/Dockerfile'
context: '.'
- name: 'ai'
dockerfile: 'ai/Dockerfile'
context: 'ai'
- name: 'jupyter'
context: 'apps/api'
dockerfile: 'apps/api/jupyter.Dockerfile'

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up Depot CLI
uses: depot/setup-action@v1

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Is release version
id: tag_check
run: |
TAG=${GITHUB_REF#refs/tags/}
if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "is_release_version=true" >> $GITHUB_ENV
else
echo "is_release_version=false" >> $GITHUB_ENV
fi
- name: Build and push tag
uses: depot/build-push-action@v1
if: env.is_release_version == 'false'
with:
project: 6zxrst4dlr
platforms: linux/amd64,linux/arm64
push: true
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
tags: briefercloud/briefer-${{ matrix.name }}:${{ github.ref_name }}

- name: Build and push tag and release
uses: depot/build-push-action@v1
if: env.is_release_version == 'true'
with:
project: 6zxrst4dlr
platforms: linux/amd64,linux/arm64
push: true
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
tags: briefercloud/briefer-${{ matrix.name }}:${{ github.ref_name }},briefercloud/briefer-${{ matrix.name }}:latest
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@briefer/api",
"version": "0.0.1",
"version": "0.0.2-alpha",
"private": true,
"type": "module",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ services:
- postgres_data:/var/lib/postgresql/data

db_migration:
image: briefercloud/briefer-api
build:
context: '.'
dockerfile: 'apps/api/Dockerfile'
Expand All @@ -31,6 +32,7 @@ services:
condition: service_healthy

jupyter_server:
image: briefercloud/briefer-jupyter
labels:
'cloud.briefer.jupyter-container': 'true'
build:
Expand All @@ -52,6 +54,7 @@ services:
retries: 5

ai:
image: briefercloud/briefer-ai
build:
context: 'ai'
dockerfile: 'Dockerfile'
Expand All @@ -69,6 +72,7 @@ services:
retries: 5

web:
image: briefercloud/briefer-web
build:
context: '.'
dockerfile: 'apps/web/Dockerfile'
Expand All @@ -84,6 +88,7 @@ services:
condition: service_healthy

api:
image: briefercloud/briefer-api
build:
context: '.'
dockerfile: 'apps/api/Dockerfile'
Expand Down

0 comments on commit 1d13c69

Please sign in to comment.