modernize dockerfile
parent
4bb9d239dd
commit
7e885720da
18
Dockerfile
18
Dockerfile
|
@ -1,20 +1,22 @@
|
|||
FROM node:16-alpine as builder
|
||||
FROM node:20-alpine as builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
COPY tsconfig.json .
|
||||
COPY src .
|
||||
RUN yarn install
|
||||
RUN yarn build
|
||||
RUN apk add --no-cache vips-dev alpine-sdk && \
|
||||
yarn install --frozen-lockfile --ignore-scripts && \
|
||||
npm rebuild sharp --build-from-source && \
|
||||
NODE_ENV=production yarn build && \
|
||||
yarn install --production --frozen-lockfile --ignore-scripts && \
|
||||
npm rebuild sharp --build-from-source
|
||||
|
||||
FROM node:16-alpine as runner
|
||||
FROM node:20-alpine as runner
|
||||
|
||||
WORKDIR /app
|
||||
# reducing container size by eliminating build-only dependencies
|
||||
COPY package.json .
|
||||
ENV NODE_ENV=production
|
||||
RUN yarn install --prod
|
||||
RUN apk add --no-cache vips-cpp
|
||||
COPY --from=builder /app/node_modules /app/node_modules
|
||||
COPY --from=builder /app/dist /app/dist
|
||||
EXPOSE 8009
|
||||
CMD ["yarn", "start"]
|
||||
|
|
Loading…
Reference in New Issue