-
-
Notifications
You must be signed in to change notification settings - Fork 283
34 lines (33 loc) · 1.15 KB
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Docker
on:
# We try to build image on each PR.
pull_request: ~
# When tagged, we also push the image to the docker registry.
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
name: Docker image build
env:
publish: ${{ github.event_name == 'push' }}
repository: 'nunomaduro/phpinsights'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get Release version
run: echo "RELEASE_VERSION=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV
if: ${{ env.publish == 'true' }}
- name: Login to docker hub
run: echo "${{ secrets.DOCKER_PASSWORD}}" | docker login -u "${{ secrets.DOCKER_USERNAME}}" --password-stdin
if: ${{ env.publish == 'true' }}
- name: Build image
run: docker build -f docker/Dockerfile -t ${{ env.repository }}:latest .
- name: Tag image
run: |
docker tag ${{ env.repository }}:latest ${{ env.repository }}:${{ env.RELEASE_VERSION }}
if: ${{ env.publish == 'true' }}
- name: Push image to hub.docker.com registry
run: docker push ${{ env.repository }}
if: ${{ env.publish == 'true' }}