Skip to content

Commit 4c96cb2

Browse files
committed
feat: add GitHub Actions workflows for API and APP production builds
1 parent ae37e16 commit 4c96cb2

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: API - Production Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'tree-disk-api/**'
9+
workflow_dispatch:
10+
11+
env:
12+
GITHUB_REGISTRY: ghcr.io
13+
IMAGE_NAME: tuke307/tree-disk-api
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
# permissions needed to push to ghcr.io
19+
permissions:
20+
contents: read
21+
packages: write
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Login to ${{ env.GITHUB_REGISTRY }}
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.GITHUB_REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Build and Push Image
36+
uses: docker/build-push-action@v6
37+
with:
38+
context: ./tree-disk-api
39+
file: ./tree-disk-api/Dockerfile
40+
platforms: linux/amd64
41+
push: true
42+
cache-from: type=gha,scope=${{ github.workflow }}
43+
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
44+
tags: |
45+
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
46+
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: APP - Production Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'tree-disk-app/**'
9+
workflow_dispatch:
10+
11+
env:
12+
GITHUB_REGISTRY: ghcr.io
13+
IMAGE_NAME: tuke307/tree-disk-app
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
# permissions needed to push to ghcr.io
19+
permissions:
20+
contents: read
21+
packages: write
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Login to ${{ env.GITHUB_REGISTRY }}
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.GITHUB_REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Build and Push Image
36+
uses: docker/build-push-action@v6
37+
with:
38+
context: ./tree-disk-app
39+
file: ./tree-disk-app/Dockerfile
40+
platforms: linux/amd64
41+
push: true
42+
cache-from: type=gha,scope=${{ github.workflow }}
43+
cache-to: type=gha,mode=max,scope=${{ github.workflow }}
44+
tags: |
45+
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
46+
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

0 commit comments

Comments
 (0)