Skip to content

Commit 5754153

Browse files
author
Miguel Martínez Triviño
authored
feat: Release container images into Github Packages repository (#128)
1 parent 90f1605 commit 5754153

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

.github/workflows/goreleaser.yml

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ jobs:
1616
uses: actions/checkout@v2
1717
- name: Unshallow
1818
run: git fetch --prune --unshallow
19+
- name: Docker login to Github Packages
20+
uses: docker/login-action@v1
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
1925
- name: Set up Go
2026
uses: actions/setup-go@v1
2127
with:

.goreleaser.yml

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ builds:
77
ldflags:
88
- -X github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/cmd.Version={{ .Version }}
99
binary: relok8s
10+
dockers:
11+
-
12+
dockerfile: Dockerfile
13+
image_templates:
14+
- "ghcr.io/vmware-tanzu/asset-relocation-tool-for-kubernetes:{{ .Tag }}"
15+
- "ghcr.io/vmware-tanzu/asset-relocation-tool-for-kubernetes:latest"
16+
build_flag_templates:
17+
- "--build-arg"
18+
- "VERSION={{ .Version }}"
19+
extra_files:
20+
- assets/docker-login.sh
1021
archives:
1122
- replacements:
1223
386: i386

Dockerfile

+7-13
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
# Copyright 2021 VMware, Inc.
22
# SPDX-License-Identifier: BSD-2-Clause
3-
FROM golang:1.17 as builder
4-
ARG VERSION
5-
6-
COPY . /asset-relocation-tool-for-kubernetes/
7-
ENV GOPATH=
8-
ENV PATH="${PATH}:/root/go/bin"
9-
WORKDIR /asset-relocation-tool-for-kubernetes/
10-
RUN make test && make build
113

4+
# Distributes the relok8s binary previously crafted by the release process
5+
# as part of the CI release action
126
FROM photon:4.0
7+
ARG VERSION
8+
ENV VERSION=${VERSION}
9+
1310
LABEL description="Asset Relocation Tool for Kubernetes"
1411
LABEL maintainer="[email protected]"
15-
16-
WORKDIR /
17-
18-
RUN yum -y install diffutils jq
12+
LABEL org.opencontainers.image.source https://github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes
1913

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

0 commit comments

Comments
 (0)