tailwind-nextjs-blog/Dockerfile

35 lines
763 B
Docker
Raw Normal View History

2022-10-09 14:44:32 +08:00
2022-07-18 20:50:38 +08:00
FROM node:16-alpine as base
2022-10-09 14:44:32 +08:00
RUN npm i --location=global pnpm@7
FROM base as deps
2022-07-18 22:34:27 +08:00
RUN apk add --no-cache libc6-compat
2022-07-18 20:50:38 +08:00
WORKDIR /app
2022-10-09 00:23:16 +08:00
COPY pnpm-lock.yaml package.json ./
2022-10-09 14:44:32 +08:00
RUN pnpm i
FROM deps as build
WORKDIR /app
2022-10-09 13:04:51 +08:00
COPY . .
2022-10-09 14:44:32 +08:00
COPY --from=deps /app ./
RUN pnpm build
2022-07-18 20:50:38 +08:00
FROM build as pre-release
2022-07-18 20:50:38 +08:00
WORKDIR /app
RUN pnpm prune --prod --config.ignore-scripts=true
FROM node:16-alpine as release
WORKDIR /app
COPY --from=pre-release /app ./
2022-07-18 20:50:38 +08:00
EXPOSE 80
CMD npm run serve -- -p 80
FROM build as export
WORKDIR /app
RUN npm run export
FROM alpine:latest as upload
RUN apk add lftp
WORKDIR /app
COPY --from=export /app/out ./
2023-03-01 20:47:17 +08:00
CMD lftp -u "${FTP_ACCOUNT},${FTP_PASSWORD}" "${FTP_HOST}" -e 'set ftp:ssl-allow off && set use-feat no && mirror -c -R --use-pget-n=10 . ./WEB && exit'