-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (48 loc) · 1.71 KB
/
docker.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
name: Build and Publish to DockerHub
on:
push:
release:
types: [published]
jobs:
publish-alpine:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/releases/')
steps:
- uses: actions/checkout@v4
- name: Docker Login - Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create Release tag
run: |
echo "bcliang/docker-libgourou" > BE_NAME
echo "${GITHUB_REF#refs/tags/releases/}-alpine" > RELEASE_TAG
- name: Build the Docker image
run: docker build . --file Dockerfile-alpine --tag $(cat BE_NAME):$(cat RELEASE_TAG)
- name: Tag to release (-alpine)
run: |
docker tag $(cat BE_NAME):$(cat RELEASE_TAG)
# - name: Push container to dockerhub
# run: docker push --all-tags $(cat BE_NAME)
publish-ubuntu:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/releases/')
steps:
- uses: actions/checkout@v4
- name: Docker Login - Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create Release tag
run: |
echo "bcliang/docker-libgourou" > BE_NAME
echo "${GITHUB_REF#refs/tags/releases/}-ubuntu" > RELEASE_TAG
- name: Build the Docker image
run: docker build . --file Dockerfile-ubuntu --tag $(cat BE_NAME):$(cat RELEASE_TAG)
- name: Tag to release (-ubuntu) + latest
run: |
docker tag $(cat BE_NAME):$(cat RELEASE_TAG) $(cat BE_NAME):latest
# - name: Push container to dockerhub
# run: docker push --all-tags $(cat BE_NAME)