-
Notifications
You must be signed in to change notification settings - Fork 11
58 lines (49 loc) · 1.71 KB
/
backend-docker-image-dockerhub-develop.yml
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
57
58
name: Backend Develop Build and Push Docker Image
on:
push:
branches: [ develop ]
paths:
- 'src/gurubase-backend/**'
- .github/workflows/backend-docker-image-dockerhub-develop.yml
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/src/gurubase-backend/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Configure Dockerhub credentials
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build and push
env:
REPOSITORY: ${{ secrets.GURUBASE_BE_PROD_STAGING_DOCKER_REPOSITORY }}
REPOSITORY_SELFHOSTED: ${{ secrets.GURUBASE_BE_SELFHOSTED_DOCKER_REPOSITORY }}
# IMAGE_TAG: ${{ github.sha }}
IMAGE_TAG: latest
uses: docker/build-push-action@v5
with:
context: src/gurubase-backend
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}
${{ env.REPOSITORY_SELFHOSTED }}:${{ env.IMAGE_TAG }}
platforms: linux/amd64,linux/arm64
file: src/gurubase-backend/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image Tag
env:
# IMAGE_TAG: ${{ github.sha }}
IMAGE_TAG: latest
run: |
echo "$IMAGE_TAG"
echo "Image Tag: $IMAGE_TAG" >> $GITHUB_STEP_SUMMARY