Skip to content

Commit

Permalink
feat: Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
maiquanghiep committed Aug 5, 2024
1 parent d66e05a commit 7a34c73
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 9 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: ci

on:
pull_request:
branches:
- '**'

jobs:
test:
uses: babylonlabs-io/.github/.github/workflows/reusable_node_lint_test.yml@hiep/add-nodejs-workflows
35 changes: 35 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: docker_publish

on:
push:
branches:
- 'hiep/add-github-actions'
# - 'main'
# - 'dev'
# tags:
# - '*'

jobs:
test:
uses: babylonlabs-io/.github/.github/workflows/reusable_node_lint_test.yml@hiep/add-nodejs-workflows

docker_pipeline:
needs: ["test"]
uses: babylonlabs-io/.github/.github/workflows/reusable_docker_pipeline.yml@hiep/add-nodejs-workflows
secrets: inherit
strategy:
matrix:
environment: [devnet, staging]
with:
publish: true
environment: ${{ matrix.environment }}
buildArgs: |
NEXT_PUBLIC_MEMPOOL_API=${{ vars.NEXT_PUBLIC_MEMPOOL_API }}
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
NEXT_PUBLIC_NETWORK=${{ vars.NEXT_PUBLIC_NETWORK }}
NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=${{ vars.NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES }}
repoName: "simple-staking-${{ matrix.environment }}"




23 changes: 14 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@ COPY tailwind.config.ts .
COPY postcss.config.js .
COPY docker-entrypoint.sh .

# We replace NEXT_PUBLIC_* variables here with placeholders
# as next.js automatically replaces those during building
# Later the docker-entrypoint.sh script finds such variables and replaces them
# with the docker environment variables we have set
RUN NEXT_PUBLIC_MEMPOOL_API=APP_NEXT_PUBLIC_MEMPOOL_API \
NEXT_PUBLIC_API_URL=APP_NEXT_PUBLIC_API_URL \
NEXT_PUBLIC_NETWORK=APP_NEXT_PUBLIC_NETWORK \
NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=APP_NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES \
npm run build

ARG NEXT_PUBLIC_MEMPOOL_API
ENV NEXT_PUBLIC_MEMPOOL_API=${NEXT_PUBLIC_MEMPOOL_API}

ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}

ARG NEXT_PUBLIC_NETWORK
ENV NEXT_PUBLIC_NETWORK=${NEXT_PUBLIC_NETWORK}

ARG NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES
ENV NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=${NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES}

RUN npm run build

# Step 2. Production image, copy all the files and run next
FROM node:22-alpine3.19 AS runner
Expand Down

0 comments on commit 7a34c73

Please sign in to comment.