Refactor action workflows and dockerfile
This commit is contained in:
parent
e7c4835c08
commit
8943f39f02
|
@ -0,0 +1,76 @@
|
||||||
|
name: Build and push Alpine Linux container images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
name: Get build meta
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ghcr.io/catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Get build-meta.json content
|
||||||
|
id: get-build-meta
|
||||||
|
uses: ActionsTools/read-json-action@main
|
||||||
|
with:
|
||||||
|
file_path: "build-meta.json"
|
||||||
|
outputs:
|
||||||
|
versions: ${{ steps.get-build-meta.outputs.versions }}
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build alpine linux container images
|
||||||
|
container:
|
||||||
|
image: ghcr.io/catthehacker/ubuntu:act-latest
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
version: ${{ fromJson(needs.prepare.outputs.versions) }}
|
||||||
|
steps:
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Login to docker.io
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
# - name: Set up QEMU
|
||||||
|
# uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Setup Docker buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Build and push alpine ${{ matrix.version }}
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
# platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
context: .
|
||||||
|
build-args: |
|
||||||
|
ALPINE_VERSION=${{ matrix.version }}
|
||||||
|
tags: |
|
||||||
|
${{ vars.DOCKERHUB_USERNAME }}/alpine:${{ matrix.version }}
|
||||||
|
- name: Build latest version
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
# platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
context: .
|
||||||
|
tags: |
|
||||||
|
${{ vars.DOCKERHUB_USERNAME }}/alpine:latest
|
||||||
|
# - name: Scan alpine9 image with Trivy
|
||||||
|
# uses: aquasecurity/trivy-action@0.20.0
|
||||||
|
# with:
|
||||||
|
# image-ref: '${{ vars.DOCKERHUB_USERNAME }}/alpine:9.5'
|
||||||
|
# format: 'sarif'
|
||||||
|
# output: 'trivy-results.sarif'
|
||||||
|
# - name: Scan alpine9-micro image with Trivy
|
||||||
|
# uses: aquasecurity/trivy-action@0.20.0
|
||||||
|
# with:
|
||||||
|
# image-ref: '${{ vars.DOCKERHUB_USERNAME }}/alpine:9.5-micro'
|
||||||
|
# format: 'sarif'
|
||||||
|
# output: 'trivy-results.sarif'
|
|
@ -1,163 +0,0 @@
|
||||||
name: Build and Push Alpine Image
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build and push image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: ghcr.io/catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Login to Docker Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: docker.io
|
|
||||||
username: aprimediet
|
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
|
||||||
- name: Build and push 3.5
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.5
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.5
|
|
||||||
- name: Build and push 3.9
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.9
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.9
|
|
||||||
- name: Build and push 3.10
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.10
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.10
|
|
||||||
- name: Build and push 3.11
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.11
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.11
|
|
||||||
- name: Build and push 3.12
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.12
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.12
|
|
||||||
- name: Build and push 3.13
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.13
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.13
|
|
||||||
- name: Build and push 3.14
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.14
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.14
|
|
||||||
- name: Build and push 3.15
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.15
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.15
|
|
||||||
- name: Build and push 3.16
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.16
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.16
|
|
||||||
- name: Build and push 3.17
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.17
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.17
|
|
||||||
- name: Build and push 3.18
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.18
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.18
|
|
||||||
- name: Build and push 3.19
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.19
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.19
|
|
||||||
- name: Build and push 3.20
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.20
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.20
|
|
||||||
- name: Build and push 3.21
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.21
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
aprimediet/alpine:3.21
|
|
||||||
aprimediet/alpine:3
|
|
||||||
aprimediet/alpine:latest
|
|
|
@ -1,163 +0,0 @@
|
||||||
name: Build and Push Alpine Image to Winter Access Registry
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build and push image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: ghcr.io/catthehacker/ubuntu:act-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out repository code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Login to Docker Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: git.winteraccess.id
|
|
||||||
username: ${{ vars.REGISTRY_USERNAME }}
|
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
||||||
- name: Build and push 3.5
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.5
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.5
|
|
||||||
- name: Build and push 3.9
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.9
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.9
|
|
||||||
- name: Build and push 3.10
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.10
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.10
|
|
||||||
- name: Build and push 3.11
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.11
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.11
|
|
||||||
- name: Build and push 3.12
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.12
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.12
|
|
||||||
- name: Build and push 3.13
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.13
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.13
|
|
||||||
- name: Build and push 3.14
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.14
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.14
|
|
||||||
- name: Build and push 3.15
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.15
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.15
|
|
||||||
- name: Build and push 3.16
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.16
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.16
|
|
||||||
- name: Build and push 3.17
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.17
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.17
|
|
||||||
- name: Build and push 3.18
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.18
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.18
|
|
||||||
- name: Build and push 3.19
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.19
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.19
|
|
||||||
- name: Build and push 3.20
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.20
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.20
|
|
||||||
- name: Build and push 3.21
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: Dockerfile
|
|
||||||
build-args: |
|
|
||||||
ALPINE_VERSION=3.21
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3.21
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:3
|
|
||||||
git.winteraccess.id/${{ gitea.repository }}:latest
|
|
38
Dockerfile
38
Dockerfile
|
@ -1,21 +1,39 @@
|
||||||
ARG ALPINE_VERSION=3.21
|
ARG ALPINE_VERSION=3.21
|
||||||
|
|
||||||
FROM alpine:${ALPINE_VERSION}
|
FROM alpine:${ALPINE_VERSION} AS builder
|
||||||
LABEL maintainer="<Aditya Prima> aprimediet@gmail.com"
|
|
||||||
|
|
||||||
ARG ALPINE_VERSION=3.20
|
ARG ALPINE_VERSION=3.21
|
||||||
ARG TZ=Asia/Jakarta
|
ARG TZ=Asia/Jakarta
|
||||||
|
|
||||||
# Set User as root
|
# Set User as root
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# INSTALL BASE DEPENDENCIES
|
# Install base dependencies, set timezone to designated timezone
|
||||||
RUN --mount=type=cache,target=/var/cache/apk \
|
RUN --mount=type=cache,target=/var/cache/apk \
|
||||||
apk add --update \
|
/sbin/apk update --no-cache; \
|
||||||
libcap tzdata curl
|
/sbin/apk upgrade --no-cache; \
|
||||||
|
/sbin/apk add --update --no-cache \
|
||||||
|
tzdata; \
|
||||||
|
/bin/echo $TZ > /etc/timezone; \
|
||||||
|
/bin/cp /usr/share/zoneinfo/$TZ /etc/localtime; \
|
||||||
|
/sbin/apk del --no-cache tzdata; \
|
||||||
|
/bin/rm -vrf /var/cache/apk/*;
|
||||||
|
|
||||||
# SET LOCAL TIMEZONE
|
FROM scratch
|
||||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
||||||
|
|
||||||
# CLEAN APK CACHES
|
ARG ALPINE_VERSION=3.21
|
||||||
RUN rm -vrf /var/cache/apk/*
|
|
||||||
|
LABEL maintainer="Muhamad Aditya Prima <aprimediet@gmail.com>"
|
||||||
|
LABEL name="alpine"
|
||||||
|
LABEL version="${ALPINE_VERSION}"
|
||||||
|
LABEL distribution-scope="public"
|
||||||
|
|
||||||
|
#labels for container catalog
|
||||||
|
LABEL summary="Alpine Linux ${ALPINE_VERSION} container image"
|
||||||
|
LABEL description="Provide latest release of Alpine Linux ${ALPINE_VERSION} container base image"
|
||||||
|
LABEL io.k8s.description="Very small alpine linux container image"
|
||||||
|
LABEL io.k8s.display-name="Alpine Linux ${ALPINE_VERSION}"
|
||||||
|
|
||||||
|
COPY --from=builder / /
|
||||||
|
|
||||||
|
CMD ["/bin/sh"]
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"versions": [
|
||||||
|
"3.6",
|
||||||
|
"3.7",
|
||||||
|
"3.8",
|
||||||
|
"3.9",
|
||||||
|
"3.10",
|
||||||
|
"3.11",
|
||||||
|
"3.12",
|
||||||
|
"3.13",
|
||||||
|
"3.14",
|
||||||
|
"3.15",
|
||||||
|
"3.16",
|
||||||
|
"3.17",
|
||||||
|
"3.18",
|
||||||
|
"3.19",
|
||||||
|
"3.20",
|
||||||
|
"3.21"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue