Skip to content

Commit

Permalink
Fix build workflow, add docker build args
Browse files Browse the repository at this point in the history
  • Loading branch information
m0ar committed Aug 14, 2024
1 parent cbccc1a commit 84d4129
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/build-dpid-resolver.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# build.yml
on:
push:
branches: # array of glob patterns matching against refs/heads. Optional; defaults to all
- main # triggers on pushes that contain changes
- develop

name: Build dpid-resolver

# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html
env:
AWS_DEFAULT_REGION: us-east-2
Expand All @@ -24,22 +21,21 @@ jobs:
timeout-minutes: 10
steps:
- name: Prepare testing env
uses: actions/checkout@v2
- uses: actions/setup-node@v2
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: npm ci && cp .env.example .env
- name: Run tests
run: npm run test
node-version-file: ".nvmrc"
check-latest: false
cache: npm
- run: npm ci
- run: npm run test
build-and-push:
name: Build and deploy
runs-on: ubuntu-latest
# needs: test
timeout-minutes: 10
steps:
- uses: hashicorp/setup-terraform@v1
- name: Checkout
uses: actions/checkout@master
- uses: actions/checkout@v4

# Add steps here like linting, testing, minification, etc.
- id: install-aws-cli
Expand Down Expand Up @@ -70,6 +66,7 @@ jobs:
run: |
# Build and tag the image
docker build \
--build-arg NODE_VERSION=$(< .nvmrc) \
-t $CONTAINER_IMAGE-dev:latest \
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$CONTAINER_IMAGE-dev \
.
Expand All @@ -79,6 +76,7 @@ jobs:
run: |
# Build and tag the image
docker build \
--build-arg NODE_VERSION=$(< .nvmrc) \
-t $CONTAINER_IMAGE:latest \
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$CONTAINER_IMAGE \
.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "module",
"scripts": {
"build": "tsc",
"build:image": "docker build --build-arg NODE_VERSION=$(< .nvmrc)",
"docker:build": "docker build --build-arg NODE_VERSION=$(< .nvmrc) .",
"watch": "tsc --watch",
"start": "node dist/index.js",
"test": "PINO_LOG_LEVEL=silent PORT=5600 vitest --config vitest.config.ts",
Expand Down

0 comments on commit 84d4129

Please sign in to comment.