Skip to content

Commit

Permalink
ci: trying to add build docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Dannecron committed Oct 10, 2023
1 parent 949dcc1 commit 9ccb6e5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG PHP_VERSION=8.2.11
ARG COMPOSER_VERSION=2.6.5

FROM php:${PHP_VERSION}-cli-alpine

COPY --from=composer:${COMPOSER_VERSION} /usr/bin/composer /usr/bin/composer

WORKDIR /app

COPY composer.json composer.json
RUN composer update --no-dev

COPY merger merger
COPY src src

ENTRYPOINT ["/app/merger"]
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,59 @@ jobs:
run: composer update
- name: Run phpstan
run: vendor/bin/phpstan analyse src tests

build-tag:
runs-on: ubuntu-22.04
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs:
- tests
- lint
- analyze
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Build docker image
run: >-
DOCKER_BUILDKIT=1 docker build
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg PHP_VERSION=${{ env.DOCKER_RUNTIME_PHP_VERSION }}
--build-arg COMPOSER_VERSION=${{ env.DOCKER_RUNTIME_COMPOSER_VERSION }}
--tag=dannecron/coverage-merger:latest
--file=./.github/Dockerfile .
- name: Login to docker hub
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Push docker image to docker-hub
uses: actions-hub/docker@master
with:
args: push dannecron/coverage-merger:${{ github.ref_name }}

build-main:
runs-on: ubuntu-22.04
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs:
- tests
- lint
- analyze
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Build docker image
run: >-
DOCKER_BUILDKIT=1 docker build
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg PHP_VERSION=${{ env.DOCKER_RUNTIME_PHP_VERSION }}
--build-arg COMPOSER_VERSION=${{ env.DOCKER_RUNTIME_COMPOSER_VERSION }}
--tag=dannecron/coverage-merger:latest
--file=./.github/Dockerfile .
- name: Login to docker hub
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Push docker image to docker-hub
uses: actions-hub/docker@master
with:
args: push dannecron/coverage-merger:latest

0 comments on commit 9ccb6e5

Please sign in to comment.