Skip to content

Commit 4f1884e

Browse files
committed
feat(build: Dockerfile + workflow
1 parent f6b1a04 commit 4f1884e

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/main.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: MAIN
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v*
9+
10+
jobs:
11+
build:
12+
name: Build & Push Docker Image
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Login to GitHub Container Registry
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: ghcr.io/${{ github.repository }}
30+
tags: |
31+
type=raw,value=latest,enable={{is_default_branch}}
32+
type=semver,pattern={{raw}}
33+
type=semver,pattern={{version}}
34+
type=semver,pattern={{major}}.{{minor}}
35+
type=semver,pattern={{major}}
36+
type=sha,format=long,prefix=
37+
38+
- name: Set up Docker
39+
uses: docker/setup-docker-action@v4
40+
with:
41+
version: latest
42+
daemon-config: |
43+
{
44+
"features": {
45+
"containerd-snapshotter": true
46+
}
47+
}
48+
49+
- name: Build and push Docker image
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: .
53+
push: true
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:lts-alpine AS build
2+
3+
WORKDIR /app
4+
5+
COPY package.json package-lock.json ./
6+
7+
RUN npm i
8+
9+
COPY . .
10+
11+
ENTRYPOINT ["npm", "start"]

0 commit comments

Comments
 (0)