Skip to content
This repository has been archived by the owner on Mar 18, 2021. It is now read-only.

Commit

Permalink
Add seihon
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatur committed Mar 3, 2020
1 parent 758371d commit 3972e3f
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 13 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@ name: Build
on: [push]

jobs:

build:
strategy:
matrix:
go: [1.14]

runs-on: ubuntu-latest
container: golang:${{ matrix.go }}-stretch
runs-on: ubuntu-18.04

steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- name: Add GOPATH/bin to PATH
# temporary fix
# see https://github.com/actions/setup-go/issues/14
run: |
set -euo pipefail
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
- name: Build
run: make
21 changes: 17 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,34 @@ on:
- '*'

jobs:

release:
strategy:
matrix:
go: [1.14]

runs-on: ubuntu-latest
container: golang:${{ matrix.go }}-stretch
runs-on: ubuntu-18.04

steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- name: Add GOPATH/bin to PATH
# temporary fix
# see https://github.com/actions/setup-go/issues/14
run: |
set -euo pipefail
echo "##[set-env name=GOPATH;]$(dirname $GITHUB_WORKSPACE)"
echo "##[add-path]$(dirname $GITHUB_WORKSPACE)/bin"
- name: Build
run: make
- name: release
run: make release
run: |
make release
make publish-images
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ FROM alpine:3.11

COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/acme-fixer/acme-fixer .
COPY --from=builder /go/acme-fixer/acme-fixer /usr/bin/acme-fixer

ENTRYPOINT ["/acme-fixer"]
ENTRYPOINT [ "/usr/bin/acme-fixer" ]
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ export DATE

default: tools check test build

tools: $(shell go env GOPATH)/bin/golangci-lint $(shell go env GOPATH)/bin/goreleaser
tools: $(shell go env GOPATH)/bin/golangci-lint $(shell go env GOPATH)/bin/goreleaser $(shell go env GOPATH)/bin/seihon

$(shell go env GOPATH)/bin/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.23.6
golangci-lint --version

$(shell go env GOPATH)/bin/goreleaser:
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | bash -s -- -b "${GOPATH}/bin"
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | bash -s -- -b $(shell go env GOPATH)/bin
goreleaser --version

$(shell go env GOPATH)/bin/seihon:
curl -sfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | bash -s -- -b $(shell go env GOPATH)/bin
seihon --version

test:
go test -v -cover ./...

Expand All @@ -35,8 +39,9 @@ build: clean
check:
golangci-lint run

docker-image:
docker build -t containous/acme-fixer:$(VERSION) .
publish-images:
echo "$(DOCKERHUB_PASSWORD)" | docker login -u "$(DOCKERHUB_USERNAME)" --password-stdin
seihon publish -v "$(VERSION)" -v "latest" --image-name="containous/acme-fixer" --dry-run=false

release: tools
goreleaser release
Expand Down
27 changes: 27 additions & 0 deletions tmpl.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dockerfile template used by Seihon to create multi-arch images.
# https://github.com/ldez/seihon
FROM golang:1-alpine as builder

RUN apk --update upgrade \
&& apk --no-cache --no-progress add git make ca-certificates tzdata

WORKDIR /go/acme-fixer

ENV GO111MODULE on

# Download go modules
COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .

RUN GOARCH={{ .GoARCH }} GOARM={{ .GoARM }} make build

FROM {{ .RuntimeImage }}

COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /go/acme-fixer/acme-fixer /usr/bin/acme-fixer

ENTRYPOINT [ "/usr/bin/acme-fixer" ]

0 comments on commit 3972e3f

Please sign in to comment.