38 lines
1.1 KiB
Docker
38 lines
1.1 KiB
Docker
FROM node:lts-alpine as base
|
|
|
|
FROM base as builder
|
|
USER 1000:1000
|
|
ADD --chown=1000:1000 . /home/node/nextts
|
|
WORKDIR /home/node/nextts
|
|
RUN wget -qO- https://get.pnpm.io/install.sh | PNPM_VERSION="8.15.3" ENV="/home/node/.shrc" SHELL="$(which sh)" sh -
|
|
ENV PATH=/home/node/.local/share/pnpm:$PATH
|
|
RUN pnpm install && pnpm run build
|
|
|
|
FROM base as runtime
|
|
|
|
RUN npm install -g pm2
|
|
|
|
|
|
COPY --from=builder /home/node/nextts/public /home/node/nextts/public
|
|
COPY --from=builder /home/node/nextts/.next/standalone /home/node/nextts
|
|
COPY --from=builder /home/node/nextts/.next/static /home/node/nextts/.next/static
|
|
ADD --chown=1000:1000 pm2.config.js /home/node/nextts/
|
|
ADD --chown=1000:1000 dummies /home/node/nextts/dummies
|
|
|
|
RUN chown -R 1000:1000 /home/node/nextts
|
|
|
|
USER 1000:1000
|
|
WORKDIR /home/node/nextts
|
|
|
|
ENV PORT 3000
|
|
ENV NODE_ENV production
|
|
ENV HOME /home/node
|
|
ENV HOSTNAME "0.0.0.0"
|
|
|
|
RUN wget -qO- https://get.pnpm.io/install.sh | PNPM_VERSION="8.15.3" ENV="/home/node/.shrc" SHELL="$(which sh)" sh -
|
|
ENV PATH=/home/node/.local/share/pnpm:$PATH
|
|
RUN pnpm install
|
|
|
|
CMD ["pm2-runtime", "pm2.config.js"]
|
|
#CMD ["node", "server.js"]
|