Add prod Dockerfile
parent
8c1f770ed9
commit
f3cfe4aaa7
@ -1,9 +1,8 @@
|
|||||||
.tmp/
|
.tmp/
|
||||||
.cache/
|
.cache/
|
||||||
.git/
|
.git/
|
||||||
.env
|
|
||||||
build/
|
build/
|
||||||
node_modules/
|
node_modules/
|
||||||
# Ignoring folders that might be used in starter templates
|
.env
|
||||||
data/
|
data/
|
||||||
backup/
|
backup/
|
@ -1,28 +1,18 @@
|
|||||||
# Creating multi-stage build for production
|
FROM node:18-alpine
|
||||||
FROM node:18-alpine as build
|
# Installing libvips-dev for sharp Compatibility
|
||||||
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev git > /dev/null 2>&1
|
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
|
||||||
ENV NODE_ENV=production
|
ARG NODE_ENV=development
|
||||||
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
|
|
||||||
WORKDIR /opt/
|
WORKDIR /opt/
|
||||||
COPY package.json yarn.lock ./
|
COPY package.json yarn.lock ./
|
||||||
RUN yarn global add node-gyp
|
RUN yarn config set network-timeout 600000 -g && yarn install
|
||||||
RUN yarn config set network-timeout 600000 -g && yarn install --production
|
|
||||||
ENV PATH /opt/node_modules/.bin:$PATH
|
|
||||||
WORKDIR /opt/app
|
|
||||||
COPY . .
|
|
||||||
RUN yarn build
|
|
||||||
|
|
||||||
# Creating final production image
|
|
||||||
FROM node:18-alpine
|
|
||||||
RUN apk add --no-cache vips-dev
|
|
||||||
ENV NODE_ENV=production
|
|
||||||
WORKDIR /opt/
|
|
||||||
COPY --from=build /opt/node_modules ./node_modules
|
|
||||||
WORKDIR /opt/app
|
WORKDIR /opt/app
|
||||||
COPY --from=build /opt/app ./
|
COPY . .
|
||||||
ENV PATH /opt/node_modules/.bin:$PATH
|
ENV PATH /opt/node_modules/.bin:$PATH
|
||||||
|
|
||||||
RUN chown -R node:node /opt/app
|
RUN chown -R node:node /opt/app
|
||||||
USER node
|
USER node
|
||||||
|
RUN ["yarn", "build"]
|
||||||
EXPOSE 1337
|
EXPOSE 1337
|
||||||
CMD ["yarn", "start"]
|
CMD ["yarn", "develop"]
|
@ -0,0 +1,29 @@
|
|||||||
|
# Creating multi-stage build for production
|
||||||
|
FROM node:18-alpine as build
|
||||||
|
RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev vips-dev > /dev/null 2>&1
|
||||||
|
ARG NODE_ENV=production
|
||||||
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
|
|
||||||
|
WORKDIR /opt/
|
||||||
|
COPY package.json yarn.lock ./
|
||||||
|
RUN yarn config set network-timeout 600000 -g && yarn install --production
|
||||||
|
ENV PATH /opt/node_modules/.bin:$PATH
|
||||||
|
WORKDIR /opt/app
|
||||||
|
COPY . .
|
||||||
|
RUN yarn build
|
||||||
|
|
||||||
|
# Creating final production image
|
||||||
|
FROM node:16-alpine
|
||||||
|
RUN apk add --no-cache vips-dev
|
||||||
|
ARG NODE_ENV=production
|
||||||
|
ENV NODE_ENV=${NODE_ENV}
|
||||||
|
WORKDIR /opt/
|
||||||
|
COPY --from=build /opt/node_modules ./node_modules
|
||||||
|
WORKDIR /opt/app
|
||||||
|
COPY --from=build /opt/app ./
|
||||||
|
ENV PATH /opt/node_modules/.bin:$PATH
|
||||||
|
|
||||||
|
RUN chown -R node:node /opt/app
|
||||||
|
USER node
|
||||||
|
EXPOSE 1337
|
||||||
|
CMD ["yarn", "start"]
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue