Skip to content

Commit e42797f

Browse files
authored
feat: add github actions to repository (#46)
1 parent 539158c commit e42797f

File tree

3 files changed

+59
-18
lines changed

3 files changed

+59
-18
lines changed

.github/workflows/docker.yaml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: docker
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- '*.*.*'
9+
pull_request:
10+
branches:
11+
- 'main'
12+
13+
jobs:
14+
docker:
15+
runs-on: ubuntu-latest
16+
steps:
17+
-
18+
name: Checkout
19+
uses: actions/checkout@v2
20+
-
21+
name: Docker meta
22+
id: meta
23+
uses: docker/metadata-action@v3
24+
with:
25+
# list of Docker images to use as base name for tags
26+
images: |
27+
foomo/pagespeed_exporter
28+
# generate Docker tags based on the following events/attributes
29+
tags: |
30+
type=ref,event=branch
31+
type=ref,event=pr
32+
type=semver,pattern={{version}}
33+
type=semver,pattern={{major}}.{{minor}}
34+
type=semver,pattern={{major}}
35+
type=sha
36+
-
37+
name: Set up QEMU
38+
uses: docker/setup-qemu-action@v1
39+
-
40+
name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v1
42+
-
43+
name: Login to DockerHub
44+
if: github.event_name != 'pull_request'
45+
uses: docker/login-action@v1
46+
with:
47+
username: ${{ secrets.DOCKERHUB_USERNAME }}
48+
password: ${{ secrets.DOCKERHUB_TOKEN }}
49+
50+
-
51+
name: Build and push
52+
uses: docker/build-push-action@v2
53+
with:
54+
context: .
55+
push: ${{ github.event_name != 'pull_request' }}
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}

.travis.yml

-17
This file was deleted.

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ COPY . ./
2121
FROM base as builder
2222
MAINTAINER Stefan Martinov <[email protected]>
2323

24-
RUN go build -ldflags "-X main.Version=`git rev-parse --short HEAD`" -o /pagespeed_exporter pagespeed_exporter.go
24+
RUN GOARCH=amd64 GOOS=linux CGO_ENABLED=0 \
25+
go build -ldflags "-X main.Version=`git rev-parse --short HEAD`" -o /pagespeed_exporter pagespeed_exporter.go
2526

2627
# strip and compress the binary
2728
RUN upx /pagespeed_exporter

0 commit comments

Comments
 (0)