-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (48 loc) · 1.62 KB
/
Copy pathdocker-build.yml
File metadata and controls
56 lines (48 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Build and Push Docker Images
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata for versioning
id: meta
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Build and push Server Image
uses: docker/build-push-action@v5
with:
context: ./server
file: ./server/Dockerfile
push: true
tags: |
suyash310/chatzy-server:latest
suyash310/chatzy-server:dev
suyash310/chatzy-server:${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.sha_short }}
cache-from: type=registry,ref=suyash310/chatzy-server:latest
cache-to: type=inline
- name: Build and push Client Image
uses: docker/build-push-action@v5
with:
context: ./client
file: ./client/Dockerfile
push: true
tags: |
suyash310/chatzy-client:latest
suyash310/chatzy-client:dev
suyash310/chatzy-client:${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.sha_short }}
cache-from: type=registry,ref=suyash310/chatzy-client:latest
cache-to: type=inline