feat: add frontend service + dockerfile + env example

This commit is contained in:
devilreef 2026-04-30 09:45:18 +06:00
parent 04835f31b6
commit eb701bbb8a
Signed by: devilreef
SSH key fingerprint: SHA256:UZisRr4iuXx+IhkbZnR655L2RWAT6o2rgbGv5F/6m3Y
3 changed files with 48 additions and 0 deletions

View file

@ -0,0 +1,5 @@
NODE_ENV=production
HOST=0.0.0.0
PORT=3000
LIBRARY_ROOT=/library
DATA_ROOT=/now-playing

View file

@ -45,3 +45,26 @@ services:
timeout: 5s timeout: 5s
retries: 3 retries: 3
start_period: 30s start_period: 30s
frontend:
build: ./frontend
image: denpa-radio-frontend:latest
restart: always
env_file: config/frontend.env
ports:
- '172.17.0.1:12001:3000'
volumes:
- type: bind
source: /mnt/trashbox/denpa-radio/library
target: /library
read_only: true
- type: bind
source: ./data/now-playing
target: /now-playing
read_only: true
healthcheck:
test: ['CMD', 'wget', '-q', '-O', '-', 'http://localhost:3000/api/stations.json']
interval: 30s
timeout: 5s
retries: 3
start_period: 15s

20
frontend/Dockerfile Normal file
View file

@ -0,0 +1,20 @@
FROM node:22-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
FROM node:22-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:22-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production HOST=0.0.0.0 PORT=3000
COPY --from=build /app/dist ./dist
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./
USER node
EXPOSE 3000
CMD ["node", "./dist/server/entry.mjs"]