From eb701bbb8a2fdb11082160ee7c6bfb1ad428bca7 Mon Sep 17 00:00:00 2001 From: devilreef Date: Thu, 30 Apr 2026 09:45:18 +0600 Subject: [PATCH] feat: add frontend service + dockerfile + env example --- config/frontend.env.example | 5 +++++ docker-compose.yml | 23 +++++++++++++++++++++++ frontend/Dockerfile | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 config/frontend.env.example create mode 100644 frontend/Dockerfile diff --git a/config/frontend.env.example b/config/frontend.env.example new file mode 100644 index 0000000..fb71aa0 --- /dev/null +++ b/config/frontend.env.example @@ -0,0 +1,5 @@ +NODE_ENV=production +HOST=0.0.0.0 +PORT=3000 +LIBRARY_ROOT=/library +DATA_ROOT=/now-playing diff --git a/docker-compose.yml b/docker-compose.yml index 1bbd3a7..7af3134 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,3 +45,26 @@ services: timeout: 5s retries: 3 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 diff --git a/frontend/Dockerfile b/frontend/Dockerfile new file mode 100644 index 0000000..de131f2 --- /dev/null +++ b/frontend/Dockerfile @@ -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"]