Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify the version of MTK used to build the image #17

Merged
merged 5 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- 'main'
- 'testing/**'
tags:
- 'v*.*.*'
pull_request:
Expand Down Expand Up @@ -54,3 +55,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
MTK_VERSION=$mtk_version
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
ARG MTK_VERSION

# build MTK from source
FROM golang:1.18-alpine as builder
FROM golang:1.22-alpine as builder

ENV MTK_VERSION=v2.0.2

WORKDIR /go/src/github.com/skpr
RUN apk add --virtual --update-cache git && \
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
RUN git clone https://github.com/skpr/mtk.git && cd mtk && git checkout 0c133b920123f05404854f3aacf44f05e6d20e03
WORKDIR /go/src/github.com/skpr/mtk/dump
ADD https://github.com/skpr/mtk.git#$MTK_VERSION ./mtk

WORKDIR /go/src/github.com/skpr/mtk

# compile
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o bin/mtk-dump github.com/skpr/mtk/dump
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -o bin/mtk-dump github.com/skpr/mtk/cmd/mtk

ARG IMAGE_REPO
FROM ${IMAGE_REPO:-uselagoon}/commons as commons

# Put in some labels so people know what this image is for
LABEL org.opencontainers.image.authors="The Lagoon Authors" maintainer="The Lagoon Authors"

COPY --from=builder /go/src/github.com/skpr/mtk/dump/bin/mtk-dump /usr/local/bin/mtk-dump
COPY --from=builder /go/src/github.com/skpr/mtk/bin/mtk-dump /usr/local/bin/mtk-dump

# Install necessary packages
# - perl for docker-login
Expand Down
10 changes: 9 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,13 @@
"matchDepTypes": ["action"],
"groupName": "GitHub actions"
}
],
"regexManagers": [
{
"fileMatch": ["(^|/|\\.)Dockerfile$"],
"matchStrings": ["ENV MTK_VERSION=(?<currentValue>.*?)\n"],
"depNameTemplate": "skpr/mtk",
"datasourceTemplate": "github-tags"
}
]
}
}