29
Dockerfile
29
Dockerfile
@@ -1,42 +1,37 @@
|
|||||||
FROM node:lts-slim AS base
|
FROM node:lts-slim AS base
|
||||||
|
|
||||||
|
# Create app directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
# Enable Corepack
|
# Enable Corepack
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
# Set Yarn to the latest stable version
|
# Set Yarn to the latest stable version
|
||||||
RUN yarn set version stable
|
RUN yarn set version stable
|
||||||
|
|
||||||
# Create app directory
|
# Files required by yarn install
|
||||||
WORKDIR /usr/src
|
COPY package.json yarn.lock ./
|
||||||
|
|
||||||
FROM base AS builder
|
|
||||||
|
|
||||||
# Files required by npm install
|
|
||||||
COPY package*.json ./
|
|
||||||
|
|
||||||
# Install app dependencies
|
# Install app dependencies
|
||||||
RUN yarn install
|
RUN yarn install --immutable
|
||||||
|
|
||||||
|
# Type check app
|
||||||
|
# RUN yarn typecheck
|
||||||
|
|
||||||
# Bundle app source
|
# Bundle app source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Type check app
|
|
||||||
RUN yarn typecheck
|
|
||||||
|
|
||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
|
|
||||||
# Files required by npm install
|
|
||||||
COPY package.json yarn.lock ./
|
|
||||||
|
|
||||||
# Install only production app dependencies
|
|
||||||
RUN yarn install --frozen-lockfile
|
|
||||||
|
|
||||||
# Bundle app source
|
# Bundle app source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# Install only production app dependencies
|
||||||
|
RUN yarn install --immutable
|
||||||
|
|
||||||
USER node
|
USER node
|
||||||
|
|
||||||
# Start the app
|
# Start the app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["yarn", "start"]
|
CMD ["yarn", "start"]
|
||||||
# CMD ["node", "--import", "tsx", "./src/main.ts"]
|
|
||||||
Reference in New Issue
Block a user