mirror of
https://github.com/mentos1386/dotfiles.git
synced 2025-01-31 00:35:42 +00:00
feat(packages): add glow
This commit is contained in:
parent
8bc2400d22
commit
b565a90685
5 changed files with 87 additions and 0 deletions
53
.github/workflows/packages.yaml
vendored
53
.github/workflows/packages.yaml
vendored
|
@ -114,3 +114,56 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
||||||
|
|
||||||
|
glow:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Prepare
|
||||||
|
id: prepare
|
||||||
|
run: |
|
||||||
|
DOCKER_IMAGE=ghcr.io/mentos1386/glow
|
||||||
|
DOCKER_PLATFORMS=linux/amd64,linux/arm64
|
||||||
|
VERSION=1.3.0
|
||||||
|
|
||||||
|
TAGS="--tag ${DOCKER_IMAGE}:${VERSION} --tag ${DOCKER_IMAGE}:latest"
|
||||||
|
|
||||||
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
|
echo ::set-output name=version::${VERSION}
|
||||||
|
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
||||||
|
--build-arg VERSION=${VERSION} \
|
||||||
|
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
||||||
|
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
||||||
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
||||||
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
||||||
|
${TAGS} --file ./packages/Dockerfile.glow .
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-glow-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-glow-
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
- name: Docker Buildx (build)
|
||||||
|
run: |
|
||||||
|
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
- name: Login to Github Registry
|
||||||
|
if: success() && github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.CR_PAT }}
|
||||||
|
- name: Docker Buildx (push)
|
||||||
|
if: success() && github.event_name != 'pull_request'
|
||||||
|
run: |
|
||||||
|
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
||||||
|
- name: Inspect image
|
||||||
|
if: always() && github.event_name != 'pull_request'
|
||||||
|
run: |
|
||||||
|
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ RUN set -ueox pipefail \
|
||||||
# Install other packages
|
# Install other packages
|
||||||
COPY --from=ghcr.io/mentos1386/starship:0.47.0 /usr/local/bin/starship /usr/local/bin/starship
|
COPY --from=ghcr.io/mentos1386/starship:0.47.0 /usr/local/bin/starship /usr/local/bin/starship
|
||||||
COPY --from=ghcr.io/mentos1386/kubectl:1.20.0 /usr/local/bin/kubectl /usr/local/bin/kubectl
|
COPY --from=ghcr.io/mentos1386/kubectl:1.20.0 /usr/local/bin/kubectl /usr/local/bin/kubectl
|
||||||
|
COPY --from=ghcr.io/mentos1386/glow:1.3.0 /usr/local/bin/glow /usr/local/bin/glow
|
||||||
# Golang
|
# Golang
|
||||||
COPY --from=golang:1.15.6 --chown=${SSH_USER} /usr/local/go /home/${SSH_USER}/.go
|
COPY --from=golang:1.15.6 --chown=${SSH_USER} /usr/local/go /home/${SSH_USER}/.go
|
||||||
ENV PATH=/home/${SSH_USER}/.go/bin:$PATH
|
ENV PATH=/home/${SSH_USER}/.go/bin:$PATH
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -9,6 +9,9 @@ build-package-starship:
|
||||||
build-package-kubectl:
|
build-package-kubectl:
|
||||||
@docker buildx build --load -t ${REGISTRY}/kubectl:1.20.0 -f packages/Dockerfile.kubectl packages/
|
@docker buildx build --load -t ${REGISTRY}/kubectl:1.20.0 -f packages/Dockerfile.kubectl packages/
|
||||||
|
|
||||||
|
build-package-glow:
|
||||||
|
@docker buildx build --progress plain --load -t ${REGISTRY}/glow:1.3.0 -f packages/Dockerfile.glow packages/
|
||||||
|
|
||||||
build-packages: package-kubectl package-starship
|
build-packages: package-kubectl package-starship
|
||||||
|
|
||||||
template:
|
template:
|
||||||
|
|
26
packages/Dockerfile.glow
Normal file
26
packages/Dockerfile.glow
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
FROM alpine:3 as build
|
||||||
|
|
||||||
|
WORKDIR /root
|
||||||
|
|
||||||
|
RUN apk --no-cache add curl tar
|
||||||
|
|
||||||
|
ARG VERSION=1.3.0
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG TARGETVARIANT
|
||||||
|
|
||||||
|
# We have to override ARCH if amd64
|
||||||
|
# https://github.com/charmbracelet/glow/blob/b9e5d6b144b111ade70e30b7f31e1c46f79a7ec9/.goreleaser.yml#L33-L37
|
||||||
|
RUN if [[ "${TARGETARCH}" == "amd64" ]]; then export ARCH="x86_64"; else export ARCH="${TARGETARCH}"; fi \
|
||||||
|
&& curl -L -o glow.tar.gz \
|
||||||
|
"https://github.com/charmbracelet/glow/releases/download/v${VERSION}/glow_${VERSION}_${TARGETOS}_${ARCH}${TARGETVARIANT}.tar.gz"
|
||||||
|
RUN tar -xzvf glow.tar.gz
|
||||||
|
|
||||||
|
FROM alpine:3
|
||||||
|
LABEL maintainer="Tine <mentos1386> Jozelj <tine@tjo.space>"
|
||||||
|
LABEL org.opencontainers.image.source https://github.com/mentos1386/workspace
|
||||||
|
|
||||||
|
COPY --from=build /root/glow /usr/local/bin/glow
|
||||||
|
|
||||||
|
ENTRYPOINT /usr/local/bin/glow
|
||||||
|
|
|
@ -25,3 +25,7 @@ version = "1.20.0"
|
||||||
name = "starship"
|
name = "starship"
|
||||||
version = "0.47.0"
|
version = "0.47.0"
|
||||||
|
|
||||||
|
[[templates."package-action".vars.jobs]]
|
||||||
|
name = "glow"
|
||||||
|
version = "1.3.0"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue