mirror of
https://github.com/maxkratz/docker_postfix.git
synced 2024-09-07 23:32:58 +00:00
Changes CI config to GitHub Actions
This commit is contained in:
parent
62a0c92c43
commit
77f5cd9b95
3 changed files with 32 additions and 99 deletions
98
.drone.yml
98
.drone.yml
|
@ -1,98 +0,0 @@
|
|||
kind: pipeline
|
||||
name: default
|
||||
|
||||
#
|
||||
# Global definitions
|
||||
#
|
||||
|
||||
# This CI uses a fork of docker/dind which also provides buildx support.
|
||||
.buildimage: &buildimage
|
||||
image: maniator/dind-buildx
|
||||
|
||||
# Environment setup.
|
||||
.env: &env
|
||||
environment:
|
||||
USERNAME:
|
||||
from_secret: dockerhub_username
|
||||
PASSWORD:
|
||||
from_secret: dockerhub_password
|
||||
REPO: maxkratz/postfix
|
||||
|
||||
# Define a temporary volue for communicating with the dind service.
|
||||
.dockervolume: &dockervolume
|
||||
volumes:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
|
||||
# Wait a bit for dind to start
|
||||
.sleep: &sleep
|
||||
sleep 5
|
||||
|
||||
# Login to dockerhub.
|
||||
.login: &login
|
||||
docker login -u $USERNAME -p $PASSWORD
|
||||
|
||||
# Setup the buildx builder.
|
||||
.setup: &setup
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && docker buildx create --name builder --driver docker-container --use && docker buildx inspect --bootstrap
|
||||
# ^normally, one would use a syntax like this:
|
||||
#.setup: &setup
|
||||
# - docker ..
|
||||
# - docker ..
|
||||
# BUT: The YAML parser of drone does not allow it and returns an error:
|
||||
# > cannot unmarshal !!seq into string
|
||||
# Therefore, the setup block uses && to run all three docker comands as one single string.
|
||||
#
|
||||
# Additionally, this command breaks if some newlines `\` are included.
|
||||
|
||||
# Only build and push images if commit is on the branch `main`.
|
||||
.ismain: &ismain
|
||||
when:
|
||||
branch:
|
||||
include:
|
||||
- main
|
||||
|
||||
# Only build(-only) images if commit is NOT on the branch `main`.
|
||||
.isnotmain: &isnotmain
|
||||
when:
|
||||
branch:
|
||||
exclude:
|
||||
- main
|
||||
|
||||
steps:
|
||||
# Build latest image without pushing it.
|
||||
- name: build-latest
|
||||
<<: *buildimage
|
||||
<<: *dockervolume
|
||||
<<: *env
|
||||
commands:
|
||||
- *sleep
|
||||
- *setup
|
||||
- docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t $REPO:latest .
|
||||
<<: *isnotmain
|
||||
|
||||
# Build and push latest image.
|
||||
- name: build-and-push-latest
|
||||
<<: *buildimage
|
||||
<<: *dockervolume
|
||||
<<: *env
|
||||
commands:
|
||||
- *sleep
|
||||
- *login
|
||||
- *setup
|
||||
- docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t $REPO:latest --push .
|
||||
<<: *ismain
|
||||
|
||||
#
|
||||
# Dind service for building Docker images.
|
||||
#
|
||||
services:
|
||||
- name: docker
|
||||
image: docker:dind
|
||||
privileged: true
|
||||
<<: *dockervolume
|
||||
|
||||
# The temporary volume for the dockersocket.
|
||||
volumes:
|
||||
- name: dockersock
|
||||
temp: {}
|
31
.github/workflows/build.yml
vendored
Normal file
31
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: Build Docker images
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'testing/**'
|
||||
- 'feature/**'
|
||||
- 'hotfix/**'
|
||||
|
||||
jobs:
|
||||
build-latest:
|
||||
runs-on: [ubuntu-22.04]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build latest
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name == 'push' && contains(github.ref, 'refs/heads/main') && github.event_name != 'schedule' }}
|
||||
tags: maxkratz/postfix:latest
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
@ -1,6 +1,6 @@
|
|||
# Docker Postfix
|
||||
|
||||
[![Build Status](https://github.ci.maxkratz.com/api/badges/maxkratz/docker_postfix/status.svg)](https://github.ci.maxkratz.com/maxkratz/docker_postfix)
|
||||
[![Build Docker images](https://github.com/maxkratz/docker_postfix/actions/workflows/build.yml/badge.svg)](https://github.com/maxkratz/docker_postfix/actions/workflows/build.yml)
|
||||
|
||||
*Unofficial* Postfix Dockerfile for backup MX (relay host) purposes
|
||||
Prebuild images can be found at this [Dockerhub repository](https://hub.docker.com/r/maxkratz/postfix).
|
||||
|
|
Loading…
Reference in a new issue