mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-12 19:02:53 +08:00
update Docker config
This commit is contained in:
parent
59c2588709
commit
bebacbd585
34
Dockerfile
34
Dockerfile
@ -1,20 +1,22 @@
|
|||||||
# Builder
|
FROM node:lts-alpine AS base
|
||||||
FROM node:18-alpine as builder
|
|
||||||
# Reference :: https://pnpm.io/docker
|
|
||||||
ENV PNPM_HOME="/pnpm"
|
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
|
||||||
RUN corepack enable
|
|
||||||
WORKDIR /src
|
|
||||||
|
|
||||||
# Cache dependencies first
|
# Stage 1: Install dependencies
|
||||||
|
FROM base AS deps
|
||||||
|
WORKDIR /app
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
RUN pnpm install
|
RUN corepack enable pnpm && pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# Copy other files and build
|
# Stage 2: Build the application
|
||||||
COPY . /src/
|
FROM base AS builder
|
||||||
RUN pnpm build
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
RUN corepack enable pnpm && pnpm run build
|
||||||
|
|
||||||
# App
|
# Stage 3: Production image
|
||||||
FROM nginxinc/nginx-unprivileged
|
FROM nginx:stable AS production
|
||||||
COPY --chown=nginx:nginx --from=builder /src/out /app
|
WORKDIR /app
|
||||||
COPY default.conf /etc/nginx/conf.d/default.conf
|
COPY --from=builder /app/out /app
|
||||||
|
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
EXPOSE 80
|
@ -1,4 +1,3 @@
|
|||||||
version: '3.9'
|
|
||||||
services:
|
services:
|
||||||
jsoncrack:
|
jsoncrack:
|
||||||
image: jsoncrack
|
image: jsoncrack
|
||||||
@ -8,3 +7,5 @@ services:
|
|||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "8888:8080"
|
- "8888:8080"
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
Loading…
x
Reference in New Issue
Block a user