62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
name: Build Docker Images
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'Dockerfile.base'
|
|
- 'tools/coder-cli/**'
|
|
- 'tools/terraform-shell/**'
|
|
schedule:
|
|
- cron: '@daily' # Daily at midnight UTC
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
REGISTRY_URL: ${{ secrets.REGISTRY_URL }}
|
|
REGISTRY_IMAGE_NAME: ${{ secrets.REGISTRY_IMAGE_NAME }}
|
|
|
|
jobs:
|
|
build:
|
|
name: Build ${{ matrix.name }} Image
|
|
runs-on: ubuntu-latest
|
|
concurrency:
|
|
group: ${{ matrix.concurrency-group }}
|
|
cancel-in-progress: false
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- name: Base
|
|
dockerfile: Dockerfile.base
|
|
tag: latest
|
|
concurrency-group: base
|
|
- name: CLI
|
|
dockerfile: tools/coder-cli/Dockerfile
|
|
tag: cli
|
|
concurrency-group: cli
|
|
- name: Terraform Shell
|
|
dockerfile: tools/terraform-shell/Dockerfile
|
|
tag: terraform
|
|
concurrency-group: terraform
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ secrets.REGISTRY_URL }}
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./${{ matrix.dockerfile }}
|
|
push: true
|
|
tags: ${{ env.REGISTRY_IMAGE_NAME }}:${{ matrix.tag }}
|