Skip to content

Commit f11ea2d

Browse files
committed
Merge pull request #91 from Kizuren/feature/dockerize
Dockerized, added docker workflow and dependabot
2 parents 3c0f439 + 6a356a5 commit f11ea2d

5 files changed

Lines changed: 87 additions & 2 deletions

File tree

.env.example

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
# Origins you want to allow
1+
# Origins you want to allow, use * to allow all origins (not recommended for production)
22

3-
ALLOWED_ORIGINS=<https://site1.com>,<https://site2.com>,...
3+
ALLOWED_ORIGINS=<https://site1.com>,<https://site2.com>,...
4+
5+
# Port the server will run on [OPTIONAL - default: 4444]
6+
PORT=4444

.github/dependabot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 5
8+
commit-message:
9+
prefix: "deps"

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [created]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Login to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Docker meta
31+
id: meta
32+
uses: docker/metadata-action@v4
33+
with:
34+
images: ghcr.io/${{ github.repository }}
35+
tags: |
36+
type=ref,event=tag
37+
type=raw,value=latest,enable={{is_default_branch}}
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
push: true
44+
platforms: linux/amd64
45+
tags: ${{ steps.meta.outputs.tags }}

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:20-alpine
2+
3+
WORKDIR /app
4+
5+
# Install system dependencies
6+
RUN apk add --no-cache git netcat-openbsd
7+
8+
# Copy package files
9+
COPY package.json ./
10+
11+
RUN npm install
12+
13+
# Copy the rest
14+
COPY . .
15+
16+
# Start app
17+
CMD ["npm", "start"]

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
app:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
container_name: anime-api
7+
restart: unless-stopped
8+
env_file:
9+
- .env
10+
ports:
11+
- '4444:${PORT:-4444}'

0 commit comments

Comments
 (0)