Skip to content

Commit 9182d10

Browse files
Create github workflow
1 parent 2e2e29b commit 9182d10

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/workflows/docker-image.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v1
17+
18+
- name: Log in to GitHub Container Registry
19+
uses: docker/login-action@v1
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Build and push Docker image
26+
uses: docker/build-push-action@v2
27+
with:
28+
context: .
29+
file: ./Dockerfile
30+
push: true
31+
tags: ghcr.io/${{ github.repository_owner }}/token-registry-api:${{ steps.get_latest_tag.outputs.tag }}
32+
build-args: |
33+
DBSYNC_TAG=${{ steps.get_latest_tag.outputs.tag }}

Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Base image
22
FROM node:20-alpine as base
33

4+
# Install Git
5+
RUN apk add --no-cache git
6+
47
# Set the working directory inside the container
58
WORKDIR /app
69

@@ -23,9 +26,14 @@ RUN yarn install --frozen-lockfile
2326
# Build the application (ensure you have a 'build' script in package.json)
2427
RUN yarn build
2528

29+
RUN node dist/forceClone.js
30+
2631
# Production stage
2732
FROM node:20-alpine as prod
2833

34+
# Install Git in production stage as well
35+
RUN apk add --no-cache git
36+
2937
WORKDIR /app
3038

3139
# Install production dependencies

0 commit comments

Comments
 (0)