-
Notifications
You must be signed in to change notification settings - Fork 6
48 lines (42 loc) · 1.57 KB
/
deploy_container.yml
File metadata and controls
48 lines (42 loc) · 1.57 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Docker image build and publish
on:
workflow_dispatch:
inputs:
instrument_name:
description: 'Instrument name'
required: true
type: string
# concurrency required to avoid lock contention during ECR provisioning
concurrency: ci-${{ github.repository }}-${{ inputs.instrument_name }}-docker-pipeline
jobs:
deploy_containers:
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
# packages: write
steps:
- uses: actions/checkout@v3
# # https://github.com/aws-actions/configure-aws-credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::449431850278:role/GitHubDeploy-L3
aws-region: us-west-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: "true" # see: https://github.com/aws-actions/amazon-ecr-login#docker-credentials
- name: Build, tag, and push docker image to GitHub Registry
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ inputs.instrument_name}}-l3-repo
IMAGE_TAG: latest
run: |
source scripts/update_version.sh
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG \
--build-arg GIT_URL=${{ inputs.git_url }} \
-f Dockerfile .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG