mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-03-03 02:20:18 +00:00
Merge pull request #72 from stefanprodan/multi-arch-build
Push releases to Docker Hub for AMD64, ARM64 and ARM v6/v7
This commit is contained in:
21
.github/workflows/push.yml
vendored
Normal file
21
.github/workflows/push.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: multi-arch-build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: '*'
|
||||
|
||||
jobs:
|
||||
build-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: crazy-max/ghaction-docker-buildx@v1
|
||||
- name: buildx
|
||||
run: |
|
||||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
docker buildx build --platform "linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64" \
|
||||
--output "type=image,push=true" \
|
||||
--build-arg "REVISION=${GITHUB_SHA}" \
|
||||
--tag "docker.io/stefanprodan/podinfo:${GITHUB_REF#refs/tags/}" \
|
||||
--tag "docker.io/stefanprodan/podinfo:latest" \
|
||||
--file Dockerfile .
|
||||
16
Dockerfile
16
Dockerfile
@@ -1,4 +1,6 @@
|
||||
FROM golang:1.14 as builder
|
||||
FROM golang:1.14-alpine as builder
|
||||
|
||||
ARG REVISION
|
||||
|
||||
RUN mkdir -p /podinfo/
|
||||
|
||||
@@ -8,16 +10,12 @@ COPY . .
|
||||
|
||||
RUN go mod download
|
||||
|
||||
RUN go test -v -race ./...
|
||||
|
||||
RUN GIT_COMMIT=$(git rev-list -1 HEAD) && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
|
||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${GIT_COMMIT}" \
|
||||
RUN CGO_ENABLED=0 go build -ldflags "-s -w \
|
||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
|
||||
-a -o bin/podinfo cmd/podinfo/*
|
||||
|
||||
RUN GIT_COMMIT=$(git rev-list -1 HEAD) && \
|
||||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
|
||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${GIT_COMMIT}" \
|
||||
RUN CGO_ENABLED=0 go build -ldflags "-s -w \
|
||||
-X github.com/stefanprodan/podinfo/pkg/version.REVISION=${REVISION}" \
|
||||
-a -o bin/podcli cmd/podcli/*
|
||||
|
||||
FROM alpine:3.11
|
||||
|
||||
@@ -22,6 +22,7 @@ Specifications:
|
||||
* Helm and Kustomize installers
|
||||
* End-to-End testing with Kubernetes Kind and Helm
|
||||
* Kustomize testing with GitHub Actions and Open Policy Agent
|
||||
* Multi-arch container image with Docker buildx and Github Actions
|
||||
|
||||
Web API:
|
||||
|
||||
|
||||
@@ -2,5 +2,7 @@
|
||||
|
||||
set -o errexit
|
||||
|
||||
docker build -t test/podinfo:latest .
|
||||
GIT_COMMIT=$(git rev-list -1 HEAD)
|
||||
|
||||
docker build -t test/podinfo:latest --build-arg "REVISION=${GIT_COMMIT}" .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user