Skip to content

Commit 0764497

Browse files
feat: add Docker support with Dockerfile, docker-compose, and GitHub Actions workflow
1 parent d5a1316 commit 0764497

File tree

5 files changed

+56
-2
lines changed

5 files changed

+56
-2
lines changed

.github/workflows/docker-image.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build and Push Docker image to GHCR
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Log in to GHCR
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Set lowercase image name
27+
id: meta
28+
run: |
29+
IMAGE_NAME="ghcr.io/${GITHUB_REPOSITORY,,}:latest"
30+
echo "image=$IMAGE_NAME" >> $GITHUB_OUTPUT
31+
32+
- name: Build and push Docker image
33+
run: |
34+
docker build -t ${{ steps.meta.outputs.image }} .
35+
docker push ${{ steps.meta.outputs.image }}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"colorWheel.settings.workspaceColor": "hsl(250,62%,47%)"
2+
"colorWheel.settings.workspaceColor": "hsl(250,62%,47%)",
3+
"cSpell.words": ["devlabs", "upayanmazumder"]
34
}

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:18-alpine
2+
WORKDIR /app
3+
COPY package*.json ./
4+
RUN npm install
5+
COPY . .
6+
EXPOSE 6969
7+
CMD ["npm", "start"]

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3.9"
2+
3+
services:
4+
volume-test-app:
5+
image: ghcr.io/upayanmazumder-devlabs/volume-test-app:latest
6+
container_name: volume-test-app
7+
ports:
8+
- "6969:6969"
9+
volumes:
10+
- ./data:/data

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"start": "node index.js"
89
},
910
"repository": {
1011
"type": "git",

0 commit comments

Comments
 (0)