Skip to content

Commit a3bd3b2

Browse files
authored
Merge pull request #5 from NujSuper/ci_build
Ci build
2 parents 8757f8e + dc5cd2b commit a3bd3b2

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "docker" # See documentation for possible values
9+
directories:
10+
- "/"
11+
schedule:
12+
interval: "weekly"
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "weekly"

.github/workflows/dev.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
docker-build:
9+
name: Build Docker
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v6
14+
with:
15+
ref: ${{ github.ref }}
16+
17+
- name: Configure AWS Credentials
18+
uses: aws-actions/configure-aws-credentials@v5
19+
with:
20+
aws-region: 'ap-southeast-2'
21+
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/github-nuj-repository-access
22+
role-session-name: NujPlatformAPISession
23+
24+
- name: Login to Amazon ECR
25+
id: login-ecr
26+
uses: aws-actions/amazon-ecr-login@v2
27+
28+
- name: Build, tag, and push the image to Amazon ECR
29+
id: build-image
30+
env:
31+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
32+
ECR_REPOSITORY: 'ssh_bastion'
33+
IMAGE_TAG: latest
34+
run: |
35+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -t $ECR_REGISTRY/$ECR_REPOSITORY:${{ github.sha }} -t $ECR_REGISTRY/$ECR_REPOSITORY:${{ github.ref_name }} .
36+
docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags

.github/workflows/pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
jobs:
8+
docker-build:
9+
name: Build Docker
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v6
14+
with:
15+
ref: ${{ github.ref }}
16+
17+
- name: Build, tag, and push the image to Amazon ECR
18+
id: build-image
19+
env:
20+
ECR_REGISTRY: local.test
21+
ECR_REPOSITORY: 'ssh_bastion'
22+
IMAGE_TAG: latest
23+
run: |
24+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .

0 commit comments

Comments
 (0)