gitea
This commit is contained in:
1 parent
9592910da5
commit
efb7d7c428
4 files changed
+61
-56
No files matched your search
@@ -0,0 +1,61 @@
|
|||||||
|
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 }}
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
image: quay.io/buildah/stable:latest
|
|
||||||
|
|
||||||
variables:
|
|
||||||
STORAGE_DRIVER: vfs
|
|
||||||
BUILDAH_FORMAT: docker
|
|
||||||
FQ_IMAGE_NAME: "$CI_REGISTRY_IMAGE"
|
|
||||||
BUILDAH_NO_PROMPT: "1"
|
|
||||||
|
|
||||||
workflow:
|
|
||||||
rules:
|
|
||||||
- if: '$CI_COMMIT_BRANCH == "main" || $CI_PIPELINE_SOURCE == "schedule"'
|
|
||||||
when: always
|
|
||||||
- when: never
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- base
|
|
||||||
|
|
||||||
build_base:
|
|
||||||
stage: base
|
|
||||||
script:
|
|
||||||
- buildah bud --storage-driver=${STORAGE_DRIVER} -t ${FQ_IMAGE_NAME}:latest -f Dockerfile.base .
|
|
||||||
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
|
|
||||||
- buildah push ${FQ_IMAGE_NAME}:latest
|
|
||||||
rules:
|
|
||||||
- changes:
|
|
||||||
- Dockerfile.base
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
||||||
|
|
||||||
|
|
||||||
include:
|
|
||||||
- "tools/coder-cli/.gitlab-ci.yml"
|
|
||||||
- "tools/terraform-shell/.gitlab-ci.yml"
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
build_cli:
|
|
||||||
stage: base
|
|
||||||
resource_group: cli
|
|
||||||
script:
|
|
||||||
- buildah info
|
|
||||||
- buildah bud --storage-driver=${STORAGE_DRIVER} -t ${FQ_IMAGE_NAME}:cli -f tools/coder-cli/Dockerfile .
|
|
||||||
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
|
|
||||||
- buildah push ${FQ_IMAGE_NAME}:cli
|
|
||||||
rules:
|
|
||||||
- changes:
|
|
||||||
- tools/coder-cli/**
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
build_shell:
|
|
||||||
stage: base
|
|
||||||
resource_group: terraform
|
|
||||||
script:
|
|
||||||
- buildah info
|
|
||||||
- buildah bud --storage-driver=${STORAGE_DRIVER} -t ${FQ_IMAGE_NAME}:terraform -f tools/terraform-shell/Dockerfile .
|
|
||||||
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
|
|
||||||
- buildah push ${FQ_IMAGE_NAME}:terraform
|
|
||||||
rules:
|
|
||||||
- changes:
|
|
||||||
- tools/terraform-shell/**
|
|
||||||
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
||||||
Reference in new issue
Block a user