Skip to content

Commit

Permalink
Separate alpine image
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocode committed Dec 11, 2022
1 parent 9ca57d6 commit 53b7e26
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/atlantis-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ concurrency:

jobs:
build:
strategy:
matrix:
image_type: [alpine]
runs-on: ubuntu-22.04
env:
DOCKER_FILE: "Dockerfile.${{ matrix.image_type }}"
IMAGE_SUFFIX: ${{ !contains(matrix.image_type, 'alpine') && '-${{ matrix.image_type }}' || '' }}
steps:
- uses: actions/checkout@v3

Expand All @@ -42,16 +48,20 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: echo "TODAY=$(date +"%Y.%m.%d")" >> $GITHUB_ENV

- name: Build and push atlantis-base:${{env.TODAY}} image
- name: Populate release version
run: echo "TODAY=$(date +"%Y.%m.%d")" >> $GITHUB_ENV

- name: Build and push atlantis-base:${{ env.TODAY }}${{ env.IMAGE_SUFFIX }} image
uses: docker/build-push-action@v3
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: docker-base
file: docker-base/${{ env.DOCKER_FILE }}
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/${{ github.repository_owner }}/atlantis-base:${{env.TODAY}}
ghcr.io/${{ github.repository_owner }}/atlantis-base:latest
ghcr.io/${{ github.repository_owner }}/atlantis-base:${{ env.TODAY }}${{ env.IMAGE_SUFFIX }}
ghcr.io/${{ github.repository_owner }}/atlantis-base:latest${{ env.IMAGE_SUFFIX }}
ghcr.io/${{ github.repository_owner }}/atlantis-base:${{ matrix.image_type }}
20 changes: 14 additions & 6 deletions .github/workflows/atlantis-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- v*.*.*-pre.* # pre release like, v0.19.0-pre.calendardate
pull_request:
paths:
- 'Dockerfile'
- 'Dockerfile.alpine'
- '.github/workflows/atlantis-image.yml'
workflow_dispatch:

Expand All @@ -19,12 +19,18 @@ concurrency:

jobs:
build:
strategy:
matrix:
image_type: [alpine]
runs-on: ubuntu-22.04
env:
RELEASE_TYPE: ${{ contains(github.ref, 'pre') && 'pre' || 'stable' }}
RELEASE_TAG: ${{ contains(github.ref, 'pre') && 'prerelease-latest' || 'latest' }}
DOCKER_FILE: "Dockerfile.${{ matrix.image_type }}"
IMAGE_SUFFIX: ${{ !contains(matrix.image_type, 'alpine') && '-${{ matrix.image_type }}' || '' }}
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version: 1.19
Expand All @@ -46,20 +52,21 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

# Publish dev image to container registry
- name: Build and push atlantis:dev image
- name: Build and push atlantis:dev${{ env.IMAGE_SUFFIX }} image
if: ${{ contains(fromJson('["push", "pull_request"]'), github.event_name) }}
uses: docker/build-push-action@v3
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: ${{ env.DOCKER_FILE }}
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/${{ github.repository_owner }}/atlantis:dev
ghcr.io/${{ github.repository_owner }}/atlantis:dev${{ env.IMAGE_SUFFIX }}
# Publish release to container registry
- name: populate release version
- name: Populate release version
if: |
contains(fromJson('["push", "pull_request"]'), github.event_name) &&
startsWith(github.ref, 'refs/tags/')
Expand All @@ -74,8 +81,9 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: ${{ env.DOCKER_FILE }}
platforms: linux/arm64/v8,linux/amd64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/${{ github.repository_owner }}/atlantis:${{ env.RELEASE_VERSION }}
ghcr.io/${{ github.repository_owner }}/atlantis:${{ env.RELEASE_TAG }}
ghcr.io/${{ github.repository_owner }}/atlantis:${{ env.RELEASE_VERSION }}${{ env.IMAGE_SUFFIX }}
ghcr.io/${{ github.repository_owner }}/atlantis:${{ env.RELEASE_TAG }}${{ env.IMAGE_SUFFIX }}
File renamed without changes.
File renamed without changes.

0 comments on commit 53b7e26

Please sign in to comment.