chore(packaging): glab docker images

This commit is contained in:
Clement Sam 2021-05-30 18:58:18 +00:00
parent 181f2eb813
commit 14ed98c0a0
3 changed files with 46 additions and 0 deletions

View File

@ -6,6 +6,7 @@ release:
before:
hooks:
- go mod tidy
- make manpage
builds:
- <<: &build_defaults
@ -71,6 +72,7 @@ nfpms:
description: An open source gitlab cli tool
license: MIT
formats:
- apk
- deb
- rpm
dependencies:
@ -78,6 +80,8 @@ nfpms:
# Override default /usr/local/bin destination for binaries
# Since glab is already archived in the bin directory it would install in /usr/bin/glab
bindir: /usr
files:
"./share/man/man1/glab*.1": "/usr/share/man/man1"
checksum:
name_template: 'checksums.txt'

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM golang:1.16-alpine
RUN apk add --no-cache bash \
curl \
docker-cli \
git \
mercurial \
make \
build-base
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "-h" ]
COPY scripts/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY dist/glab_*.apk /tmp/
RUN apk add --allow-untrusted /tmp/glab_*.apk

24
scripts/entrypoint.sh Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
if [ -n "$DOCKER_USERNAME" ] && [ -n "$DOCKER_PASSWORD" ]; then
echo "Login to the docker..."
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin "$DOCKER_REGISTRY"
fi
# Workaround for github actions when access to different repositories is needed.
# Github actions provides a GITHUB_TOKEN secret that can only access the current
# repository and you cannot configure it's value.
# Access to different repositories is needed by brew for example.
if [ -n "$PS_TOKEN" ] ; then
export GITHUB_TOKEN=$PS_TOKEN
fi
if [ -n "$GITHUB_TOKEN" ]; then
# Log into GitHub package registry
echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u docker --password-stdin
echo "$GITHUB_TOKEN" | docker login ghcr.io -u docker --password-stdin
fi
# shellcheck disable=SC2068
glab $@