Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Ariff <ali.ariff12@gmail.com>
  • Loading branch information
aliariff committed Jun 23, 2020
1 parent 37ef901 commit edbd1af
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 4 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release
on:
push:
tags:
- "*"
jobs:
buildx:
name: Build & Push Multi Arch Images
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Configure gcloud
uses: linkerd/linkerd2-action-gcloud@v1.0.2
with:
cloud_sdk_service_account_key: ${{ secrets.CLOUD_SDK_SERVICE_ACCOUNT_KEY }}
gcp_project: ${{ secrets.GCP_PROJECT }}
gcp_zone: ${{ secrets.GCP_ZONE }}
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v3
- name: Docker Buildx (build)
run: make images
- name: Docker Buildx (push)
run: make push
- name: Docker Check Manifest
run: make inspect-manifest
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
## compile proxy-init utility
FROM golang:1.12.9 as golang
FROM --platform=$BUILDPLATFORM golang:1.12.9 as golang
WORKDIR /build

# cache dependencies
COPY go.mod .
COPY go.sum .
RUN go mod download

# build
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /out/linkerd2-proxy-init -mod=readonly -ldflags "-s -w" -v
ARG TARGETARCH
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -o /out/linkerd2-proxy-init -mod=readonly -ldflags "-s -w" -v

## package runtime
FROM debian:stretch-20190812-slim
FROM --platform=$TARGETPLATFORM debian:stretch-20190812-slim
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
iptables \
Expand Down
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
DOCKER_REGISTRY ?= gcr.io/linkerd-io
REPO = $(DOCKER_REGISTRY)/proxy-init
TESTER_REPO = buoyantio/iptables-tester
VERSION ?= $(shell git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD)
SUPPORTED_ARCHS = linux/amd64,linux/arm64,linux/arm/v7

.DEFAULT_GOAL := help

Expand Down Expand Up @@ -39,7 +41,7 @@ integration-test: image ## Perform integration test
###############
.PHONY: image
image: ## Build docker image for the project
docker build -t $(REPO):latest .
DOCKER_BUILDKIT=1 docker build -t $(REPO):latest .

.PHONY: tester-image
tester-image: ## Build docker image for the tester component
Expand All @@ -49,3 +51,26 @@ tester-image: ## Build docker image for the tester component
kind-load: image tester-image ## Load the required image to KinD cluster
kind load docker-image $(REPO):latest
kind load docker-image $(TESTER_REPO):v1

.PHONY: images
images: ## Build multi arch docker images for the project
docker buildx build \
--platform $(SUPPORTED_ARCHS) \
--output "type=image,push=false" \
--tag $(REPO):$(VERSION) \
--tag $(REPO):latest \
.

.PHONY: push
push: images ## Push multi arch docker images to the registry
docker buildx build \
--platform $(SUPPORTED_ARCHS) \
--output "type=image,push=true" \
--tag $(REPO):$(VERSION) \
--tag $(REPO):latest \
.

.PHONY: inspect-manifest
inspect-manifest: ## Check the resulting images supported architecture
docker run --rm mplatform/mquery $(REPO):$(VERSION)
docker run --rm mplatform/mquery $(REPO):latest

0 comments on commit edbd1af

Please sign in to comment.