add dockerfile

This commit is contained in:
Yusron alamsyah
2026-04-13 09:22:42 +07:00
parent 133f3b48be
commit 1665f328ab
3 changed files with 55 additions and 3 deletions
+1 -3
View File
@@ -5,6 +5,4 @@ node_modules
.cache
.output
.env
dist
Dockerfile
docker-compose.yml
dist
+35
View File
@@ -0,0 +1,35 @@
# syntax=docker/dockerfile:1
FROM node:20-alpine AS deps
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
FROM node:20-alpine AS build
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NITRO_HOST=0.0.0.0
ENV NITRO_PORT=3001
ENV HOST=0.0.0.0
ENV PORT=3001
ENV AUTH_ORIGIN=http://localhost:3001
COPY --from=build /app/.output ./.output
RUN chown -R node:node /app
USER node
EXPOSE 3001
CMD ["node", ".output/server/index.mjs"]
+19
View File
@@ -0,0 +1,19 @@
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
container_name: module-farmasi
env_file:
- .env
environment:
AUTH_ORIGIN: ${AUTH_ORIGIN:-http://localhost:3001}
NITRO_HOST: ${NITRO_HOST:-0.0.0.0}
NITRO_PORT: ${NITRO_PORT:-3001}
HOST: ${HOST:-0.0.0.0}
PORT: ${PORT:-3001}
ports:
- "3001:3001"
restart: unless-stopped