Skip to content

Commit a5e88a0

Browse files
authored
add: Docker image #45
This commit (squash) adds support for running NodeLink in Docker container with Dockerfile.
1 parent cd721a0 commit a5e88a0

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.github
3+
docs

.github/workflows/docker-image.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build:
11+
name: Publish Docker image
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Get package version
19+
id: package-version
20+
uses: martinbeentjes/[email protected]
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Generate Docker meta
29+
id: meta
30+
uses: docker/metadata-action@v4
31+
with:
32+
images: ${{ secrets.DOCKERHUB_USERNAME }}/nodelink
33+
tags: |
34+
type=raw,value=${{ steps.package-version.outputs.current-version}}
35+
type=raw,value=latest
36+
37+
- name: Login to Docker Hub
38+
uses: docker/login-action@v3
39+
with:
40+
username: ${{ secrets.DOCKERHUB_USERNAME }}
41+
password: ${{ secrets.DOCKERHUB_TOKEN }}
42+
43+
- name: Build and Push
44+
uses: docker/build-push-action@v5
45+
with:
46+
push: true
47+
platforms: linux/amd64, linux/arm64
48+
tags: ${{ steps.meta.outputs.tags }}
49+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM node:lts-alpine
2+
WORKDIR /usr/src/app
3+
4+
COPY . .
5+
6+
RUN apk add --no-cache ffmpeg
7+
8+
ENV NODE_ENV=production
9+
10+
RUN npm i
11+
12+
CMD ["npm", "start"]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"type": "module",
3+
"version": "2.0.1",
34
"scripts": {
45
"start": "node --dns-result-order=ipv4first --openssl-legacy-provider src/connection/index.js"
56
},

0 commit comments

Comments
 (0)