Skip to content

Commit 7883d08

Browse files
committed
feat: build docker image with actions
1 parent 51bfe14 commit 7883d08

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/dockerimage.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Docker Build/Publish Image
2+
on:
3+
push:
4+
branches: [ master ]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-18.04
8+
env:
9+
DOCKER_REGISTRY: kemansel.azurecr.io
10+
DOCKER_IMAGE: kmansel/express-me
11+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
12+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
13+
DOCKER_TARGET_PLATFORM: linux/arm/v7
14+
steps:
15+
- name: Checkout the code
16+
uses: actions/checkout@v1
17+
- name: Set up Docker Buildx
18+
uses: crazy-max/ghaction-docker-buildx@v1
19+
with:
20+
version: latest
21+
- name: Prepare
22+
if: success()
23+
id: prepare
24+
run: |
25+
echo ::set-output name=docker_platform::${DOCKER_TARGET_PLATFORM}
26+
echo ::set-output name=docker_image::${DOCKER_REGISTRY}/${DOCKER_IMAGE}
27+
echo ::set-output name=version::${GITHUB_RUN_NUMBER}
28+
- name: Docker Login
29+
if: success()
30+
run: |
31+
echo "${DOCKER_PASSWORD}" | docker login ${DOCKER_REGISTRY} --username "${DOCKER_USERNAME}" --password-stdin
32+
- name: Run Buildx (push image)
33+
if: success()
34+
run: |
35+
docker buildx build \ --platform ${{ steps.prepare.outputs.docker_platform }} \ --tag ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} \ --file ./Dockerfile \ --output type=image,push=true .

0 commit comments

Comments
 (0)