generated from Avanade/avanade-template
-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (27 loc) · 1.16 KB
/
docker-build-and-push.yml
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
name: Docker Build & Push
run-name: Docker Build & Push [${{inputs.selected_environment}}]
on:
workflow_dispatch:
inputs:
selected_environment:
type: environment
description: Select environment
default: test
jobs:
build-and-push-image:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.selected_environment }}
defaults:
run:
working-directory: src/goapp
steps:
- uses: actions/checkout@v2
- uses: azure/docker-login@v1
with:
login-server: ${{ secrets.CONTAINER_REGISTRY_SERVER }}
username: ${{ secrets.CONTAINER_REGISTRY_SERVER_USERNAME }}
password: ${{ secrets.CONTAINER_REGISTRY_SERVER_PASSWORD }}
- run: |
touch .env
docker build . -t ${{ secrets.CONTAINER_REGISTRY_SERVER }}/${{vars.APPSERVICE_NAME}}:${{ github.sha }} -t ${{ secrets.CONTAINER_REGISTRY_SERVER }}/${{vars.APPSERVICE_NAME}}:latest
docker push ${{ secrets.CONTAINER_REGISTRY_SERVER }}/${{vars.APPSERVICE_NAME}}