diff --git a/.gitea/workflows/alpine.yaml b/.gitea/workflows/alpine.yaml new file mode 100644 index 0000000..f07ddd3 --- /dev/null +++ b/.gitea/workflows/alpine.yaml @@ -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' diff --git a/.gitea/workflows/dockerio.yaml b/.gitea/workflows/dockerio.yaml deleted file mode 100644 index a1ab69a..0000000 --- a/.gitea/workflows/dockerio.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.gitea/workflows/winter.yaml b/.gitea/workflows/winter.yaml deleted file mode 100644 index ed6724c..0000000 --- a/.gitea/workflows/winter.yaml +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d3ad529..5e0e771 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,39 @@ ARG ALPINE_VERSION=3.21 -FROM alpine:${ALPINE_VERSION} -LABEL maintainer=" aprimediet@gmail.com" +FROM alpine:${ALPINE_VERSION} AS builder -ARG ALPINE_VERSION=3.20 +ARG ALPINE_VERSION=3.21 ARG TZ=Asia/Jakarta # Set User as root USER root -# INSTALL BASE DEPENDENCIES +# Install base dependencies, set timezone to designated timezone RUN --mount=type=cache,target=/var/cache/apk \ - apk add --update \ - libcap tzdata curl + /sbin/apk update --no-cache; \ + /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 -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +FROM scratch -# CLEAN APK CACHES -RUN rm -vrf /var/cache/apk/* \ No newline at end of file +ARG ALPINE_VERSION=3.21 + +LABEL maintainer="Muhamad Aditya Prima " +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"] \ No newline at end of file diff --git a/build-meta.json b/build-meta.json new file mode 100644 index 0000000..bcd4c66 --- /dev/null +++ b/build-meta.json @@ -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" + ] +} \ No newline at end of file