Skip to content

Commit 3e2e1f4

Browse files
guidopetriNi-g-3l
authored andcommitted
Build Docker image and push to Dockerhub (stringer-rss#1080)
* revert CircleCI build changes * add build and push to dockerhub via github actions
1 parent c09a994 commit 3e2e1f4

File tree

2 files changed

+57
-17
lines changed

2 files changed

+57
-17
lines changed

.circleci/config.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ version: 2.1
33
orbs:
44
browser-tools: circleci/[email protected]
55
node: circleci/[email protected]
6-
docker: circleci/[email protected]
76

87
jobs:
9-
run-tests:
8+
build:
109
parallelism: 1
1110
docker:
1211
- image: cimg/ruby:3.2.2-browsers
@@ -108,18 +107,3 @@ jobs:
108107
name: Run system tests
109108
command: |
110109
COVERAGE=false bundle exec rspec spec/system/
111-
112-
workflows:
113-
test-build-and-publish-image:
114-
jobs:
115-
- run-tests
116-
- docker/publish:
117-
cache_from: stringerrss/stringer:latest
118-
image: stringerrss/stringer
119-
tag: latest,$CIRCLE_SHA1
120-
update-description: false
121-
requires:
122-
- run-tests
123-
filters:
124-
branches:
125-
only: main

.github/workflows/build.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build Docker image and push to Dockerhub
2+
3+
on:
4+
push
5+
env:
6+
IMAGE_NAME: stringerrss/stringer
7+
8+
jobs:
9+
buildx:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v2
17+
18+
- name: Set up Docker Buildx
19+
id: buildx
20+
uses: docker/setup-buildx-action@v2
21+
22+
- name: Extract Docker sha tag
23+
id: get-tag-sha
24+
uses: docker/metadata-action@v4
25+
with:
26+
images: ${{ env.IMAGE_NAME }}
27+
tags: type=sha
28+
29+
- name: Extract Docker latest tag
30+
id: get-tag-latest
31+
uses: docker/metadata-action@v4
32+
with:
33+
images: ${{ env.IMAGE_NAME }}
34+
tags: type=raw, value=latest
35+
36+
- name: Log in to Docker Hub
37+
if: ${{ github.ref_name == 'main' }}
38+
id: login
39+
uses: docker/login-action@v2
40+
with:
41+
username: ${{ secrets.DOCKERHUB_USERNAME }}
42+
password: ${{ secrets.DOCKERHUB_TOKEN }}
43+
44+
- name: Build and Push
45+
id: build-and-push
46+
uses: docker/build-push-action@v3
47+
with:
48+
context: .
49+
file: ./Dockerfile
50+
platforms: linux/amd64,linux/arm64
51+
push: ${{ github.ref_name == 'main' }}
52+
tags: |
53+
${{ steps.get-tag-latest.outputs.tags }}
54+
${{ steps.get-tag-sha.outputs.tags }}
55+
cache-from: type=gha
56+
cache-to: type=gha

0 commit comments

Comments
 (0)