Skip to content

Commit

Permalink
feat: Release container images into Github Packages repository (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Martínez Triviño authored Jan 11, 2022
1 parent 90f1605 commit 5754153
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ jobs:
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Docker login to Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v1
with:
Expand Down
11 changes: 11 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ builds:
ldflags:
- -X github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/cmd.Version={{ .Version }}
binary: relok8s
dockers:
-
dockerfile: Dockerfile
image_templates:
- "ghcr.io/vmware-tanzu/asset-relocation-tool-for-kubernetes:{{ .Tag }}"
- "ghcr.io/vmware-tanzu/asset-relocation-tool-for-kubernetes:latest"
build_flag_templates:
- "--build-arg"
- "VERSION={{ .Version }}"
extra_files:
- assets/docker-login.sh
archives:
- replacements:
386: i386
Expand Down
20 changes: 7 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
FROM golang:1.17 as builder
ARG VERSION

COPY . /asset-relocation-tool-for-kubernetes/
ENV GOPATH=
ENV PATH="${PATH}:/root/go/bin"
WORKDIR /asset-relocation-tool-for-kubernetes/
RUN make test && make build

# Distributes the relok8s binary previously crafted by the release process
# as part of the CI release action
FROM photon:4.0
ARG VERSION
ENV VERSION=${VERSION}

LABEL description="Asset Relocation Tool for Kubernetes"
LABEL maintainer="tanzu-isv-engineering@groups.vmware.com"

WORKDIR /

RUN yum -y install diffutils jq
LABEL org.opencontainers.image.source https://github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes

COPY assets/docker-login.sh /usr/local/bin/docker-login.sh
COPY --from=builder /asset-relocation-tool-for-kubernetes/build/relok8s /usr/local/bin/relok8s
COPY ./relok8s /usr/local/bin
ENTRYPOINT ["/usr/local/bin/relok8s"]

0 comments on commit 5754153

Please sign in to comment.