Skip to content

Commit

Permalink
(workshop): test pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
wickstargazer committed Sep 14, 2024
1 parent af97c22 commit 4dcd60a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/example-build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Push Docker Image to ECR

on:
push:
branches:
- example/pipeline # or specify any branch you want to trigger this workflow on

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout the code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Configure AWS credentials with session token
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }} # Use the session token
aws-region: us-east-1 # Change to your AWS region

- name: Build, tag, and push Docker image
env:
ECR_URI: "778529894665.dkr.ecr.us-east-1.amazonaws.com/web-app"
IMAGE_TAG: ${{ github.sha }}
run: |
yarn nx build api-flowaccount-workshop
docker build -t $ECR_URI:$IMAGE_TAG .
docker push $ECR_URI:$IMAGE_TAG
- name: Image digest
run: |
IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ env.REPO_URI }}:${{ github.sha }})
echo "Docker image pushed: $IMAGE_DIGEST"
1 change: 1 addition & 0 deletions apps/api/flowaccount-workshop/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"outputPath": "dist/apps/api/flowaccount-workshop",
"main": "apps/api/flowaccount-workshop/src/main.ts",
"tsConfig": "apps/api/flowaccount-workshop/tsconfig.app.json",
"isolatedConfig": false,
"assets": [
"apps/api/flowaccount-workshop/src/assets",
"apps/api/flowaccount-workshop/src/README.md"
Expand Down
14 changes: 14 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:fermium

ARG GITCOMMIT=""
ENV GIT_COMMIT_HASH=${GITCOMMIT}

WORKDIR /app

COPY . .

RUN npm install

CMD ["node", "main.js"]

EXPOSE 8081

0 comments on commit 4dcd60a

Please sign in to comment.