Skip to content

Commit dc566b7

Browse files
committed
feat: publish docke image on dockerhub
1 parent 1d6a59a commit dc566b7

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish docker image
2+
3+
on:
4+
push:
5+
branches:
6+
# todo: Replace with `main` in the final version
7+
- "docker"
8+
- "releases/v*"
9+
tags:
10+
- "v*"
11+
pull_request:
12+
branches:
13+
# todo: Replace with `main` in the final version
14+
- "docker"
15+
- "releases/v*"
16+
17+
env:
18+
# todo: Replace with `torrust/torrust-tracker` in the final version
19+
DOCKER_IMAGE: josecelano/torrust-tracker
20+
21+
jobs:
22+
dockerhub:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Docker meta
29+
id: meta
30+
uses: docker/metadata-action@v4
31+
with:
32+
images: |
33+
${{ env.DOCKER_IMAGE }}
34+
tags: |
35+
type=ref,event=branch
36+
type=ref,event=pr
37+
type=semver,pattern={{version}}
38+
type=semver,pattern={{major}}.{{minor}}
39+
40+
- name: Login to Docker Hub
41+
uses: docker/login-action@v2
42+
with:
43+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
44+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v2
48+
49+
- name: Build and push
50+
uses: docker/build-push-action@v3
51+
with:
52+
context: .
53+
file: ./Dockerfile
54+
push: ${{ github.event_name != 'pull_request' }}
55+
tags: ${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max

cSpell.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
"Bitflu",
1010
"bools",
1111
"bufs",
12+
"Buildx",
1213
"byteorder",
1314
"canonicalize",
1415
"canonicalized",
1516
"chrono",
1617
"clippy",
1718
"completei",
19+
"dockerhub",
1820
"downloadedi",
1921
"filesd",
2022
"Freebox",

0 commit comments

Comments
 (0)