Skip to content

Commit 49ff3be

Browse files
committed
remove travis-ci, github actions, multi-arch docker images
1 parent fdde67f commit 49ff3be

File tree

3 files changed

+117
-1
lines changed

3 files changed

+117
-1
lines changed

.github/workflows/docker_image.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
2+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif
3+
# https://github.community/t/how-to-get-just-the-tag-name/16241/10
4+
5+
name: docker_image
6+
7+
on:
8+
push:
9+
tags:
10+
- "v*"
11+
branches:
12+
- master
13+
- next
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: cancel previous runs
21+
uses: styfle/cancel-workflow-action@0.6.0
22+
with:
23+
access_token: ${{ github.token }}
24+
25+
- name: docker build
26+
run: |
27+
export ARCH=$([ $(uname -m) = "x86_64" ] && echo "amd64" || echo "arm64")
28+
mkdir -p ~/.docker/cli-plugins/
29+
wget -qO ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-${ARCH}
30+
chmod a+x ~/.docker/cli-plugins/docker-buildx
31+
docker info
32+
docker buildx version
33+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
34+
docker buildx create --name xbuilder --use
35+
docker buildx inspect --bootstrap
36+
.github/bin/docker-release.sh
37+
38+
env:
39+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
40+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
41+
DOCKER_CLI_EXPERIMENTAL: enabled
42+
DOCKER_BUILD_PLATFORM: linux/amd64,linux/arm/v7,linux/arm64
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
2+
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif
3+
# https://github.community/t/how-to-get-just-the-tag-name/16241/10
4+
5+
name: github_release
6+
7+
on:
8+
push:
9+
tags:
10+
- "v*"
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: cancel previous runs
18+
uses: styfle/cancel-workflow-action@0.6.0
19+
with:
20+
access_token: ${{ github.token }}
21+
22+
- name: source info
23+
id: source_info
24+
run: |
25+
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
26+
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
27+
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
28+
29+
- uses: actions/setup-go@v2
30+
with:
31+
stable: 'false'
32+
go-version: '1.15.7'
33+
34+
- uses: actions/checkout@v2
35+
36+
- name: build_release_assets
37+
run: |
38+
mkdir -p bin_release
39+
GOPATH="" CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags "-extldflags '-static' -X main.AppVersion=$SOURCE_TAG" -o bin_release/freenas-iscsi-provisioner_linux-amd64
40+
GOPATH="" CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -a -ldflags "-extldflags '-static' -X main.AppVersion=$SOURCE_TAG" -o bin_release/freenas-iscsi-provisioner_linux-arm
41+
GOPATH="" CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -ldflags "-extldflags '-static' -X main.AppVersion=$SOURCE_TAG" -o bin_release/freenas-iscsi-provisioner_linux-arm64
42+
GOPATH="" CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -ldflags "-extldflags '-static' -X main.AppVersion=$SOURCE_TAG" -o bin_release/freenas-iscsi-provisioner_darwin-amd64
43+
GOPATH="" CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -a -ldflags "-extldflags '-static' -X main.AppVersion=$SOURCE_TAG" -o bin_release/freenas-iscsi-provisioner_freebsd-amd64
44+
45+
- name: create release
46+
id: create_release
47+
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
48+
uses: actions/create-release@v1
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
tag_name: ${{ github.ref }}
53+
release_name: ${{ github.ref }}
54+
draft: false
55+
prerelease: false
56+
57+
- name: upload release assets
58+
id: upload-release-assets
59+
uses: alexellis/upload-assets@0.2.2
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
asset_paths: '["./bin_release/freenas-iscsi-provisioner_*"]'
64+

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1+
######################
2+
# build image
3+
######################
4+
FROM golang:1.15.7 AS build
5+
6+
ARG GIT_TAG
7+
COPY . .
8+
RUN \
9+
GOPATH="" CGO_ENABLED=0 go build -a -ldflags "-extldflags '-static' -X main.AppVersion=${GIT_TAG:=HEAD}" -o /tmp/freenas-iscsi-provisioner
10+
111
FROM alpine
212

313
RUN apk update && \
414
apk add ca-certificates && \
515
rm -rf /var/cache/apk/* && \
616
update-ca-certificates
717

8-
COPY bin/freenas-iscsi-provisioner /freenas-iscsi-provisioner
18+
COPY --from=build /tmp/freenas-iscsi-provisioner /freenas-iscsi-provisioner
919

1020
ENTRYPOINT ["/freenas-iscsi-provisioner"]

0 commit comments

Comments
 (0)