55 lines
1.2 KiB
Docker
55 lines
1.2 KiB
Docker
|
|
# gitzone dockerfile_service
|
||
|
|
## STAGE 1 // BUILD frontend bundle
|
||
|
|
FROM --platform=linux/amd64 node:22-alpine AS build
|
||
|
|
|
||
|
|
# Install pnpm
|
||
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Use verdaccio registry (hosts private packages and proxies public ones)
|
||
|
|
RUN npm config set registry https://verdaccio.lossless.digital/
|
||
|
|
|
||
|
|
# Install dependencies first (better caching)
|
||
|
|
COPY package.json pnpm-lock.yaml ./
|
||
|
|
RUN pnpm install
|
||
|
|
|
||
|
|
# Copy source and build
|
||
|
|
COPY npmextra.json ./
|
||
|
|
COPY html/ ./html/
|
||
|
|
COPY ts_web/ ./ts_web/
|
||
|
|
COPY ts_interfaces/ ./ts_interfaces/
|
||
|
|
COPY ts_bundled/ ./ts_bundled/
|
||
|
|
RUN pnpm run build
|
||
|
|
|
||
|
|
## STAGE 2 // production runtime with Deno
|
||
|
|
FROM alpine:edge AS final
|
||
|
|
|
||
|
|
# Install Deno and minimal runtime dependencies
|
||
|
|
RUN apk add --no-cache \
|
||
|
|
deno \
|
||
|
|
ca-certificates \
|
||
|
|
tini \
|
||
|
|
gcompat \
|
||
|
|
libstdc++
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Copy only what Deno needs at runtime
|
||
|
|
COPY deno.json ./
|
||
|
|
COPY mod.ts ./
|
||
|
|
COPY ts/ ./ts/
|
||
|
|
COPY ts_interfaces/ ./ts_interfaces/
|
||
|
|
COPY --from=build /app/ts_bundled/bundle.ts ./ts_bundled/bundle.ts
|
||
|
|
|
||
|
|
# Pre-cache Deno dependencies
|
||
|
|
RUN deno cache mod.ts
|
||
|
|
|
||
|
|
# Create storage directory
|
||
|
|
RUN mkdir -p /data
|
||
|
|
|
||
|
|
EXPOSE 9000 3000
|
||
|
|
VOLUME ["/data"]
|
||
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||
|
|
CMD ["deno", "run", "--allow-all", "mod.ts", "server"]
|