Skip to content

Commit

Permalink
Build images with matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimalekseev committed Aug 13, 2023
1 parent e8bbe05 commit 8f315d9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ jobs:
permissions:
packages: write
contents: read

strategy:
fail-fast: false
matrix:
image:
- name: 'ubuntu:18.04'
suffix: '-ubuntu18.04'
- name: 'ubuntu:20.04'
suffix: '-ubuntu20.04'
- name: 'ubuntu:22.04'
suffix: '-ubuntu22.04'
- name: 'ubuntu:latest'
suffix: ''
steps:
- uses: actions/checkout@v3

Expand All @@ -35,6 +46,7 @@ jobs:
uses: docker/build-push-action@v4
with:
push: true
build-args:
- VERSION=${{ steps.set-version.outputs.VERSION }}
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.set-version.outputs.VERSION }}
build-args: |
VERSION=${{ steps.set-version.outputs.VERSION }}
APP_IMAGE=${{ matrix.app_image }}
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.set-version.outputs.VERSION }}${{ matrix.image.suffix }}
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
ARG APP_IMAGE=ubuntu:latest

# Build
FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS build

ARG VERSION
ARG BUILD_TIME

RUN apk update
RUN apk add git

WORKDIR /file.d

COPY go.mod go.sum ./
Expand All @@ -25,7 +24,7 @@ RUN go build -trimpath \
-o file.d ./cmd/file.d

# Deploy
FROM ubuntu:20.04
FROM $APP_IMAGE

RUN apt update
RUN apt install systemd strace tcpdump traceroute telnet iotop curl jq iputils-ping htop -y
Expand Down

0 comments on commit 8f315d9

Please sign in to comment.