Skip to content

Commit

Permalink
add new workflow to build and publish Docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
deminy committed Jan 11, 2024
1 parent 727bf74 commit e50ed76
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build_docker_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Docker Images

on:
push:
branches:
- master

jobs:
build_docker_image:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
docker:
- {type: "php", tag: "php-only"}
- {type: "swoole", tag: "swoole-enabled"}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image deminy/counit:${{ matrix.docker.tag }}
uses: docker/build-push-action@v5
with:
context: ./dockerfiles/${{ matrix.docker.type }}
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: true
tags: deminy/counit:${{ matrix.docker.tag }}
2 changes: 1 addition & 1 deletion dockerfiles/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ RUN set -ex \
docker-php-ext-enable redis && \
docker-php-ext-install mysqli pdo_mysql && \
apk del .build-deps && \
rm -rf /var/cache/apk/* /tmp/*
rm -rf /var/cache/apk/*

WORKDIR "/var/www/"
2 changes: 1 addition & 1 deletion dockerfiles/swoole/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ RUN set -ex \
docker-php-ext-enable redis && \
docker-php-ext-install mysqli pdo_mysql && \
apk del .build-deps && \
rm -rf /var/cache/apk/* /tmp/*
rm -rf /var/cache/apk/*

0 comments on commit e50ed76

Please sign in to comment.