项目文件夹

文件
2023-08-16 02:18:53 +07:00

37 行
954 B
Docker

# ---- Base Node ----
FROM node:19-alpine AS base
WORKDIR /app
COPY package*.json ./
# ---- Dependencies ----
FROM base AS dependencies
RUN npm ci
# ---- Build ----
FROM dependencies AS build
COPY . .
RUN npm run build
# ---- Production ----
FROM node:19-alpine AS production
WORKDIR /app
COPY --from=dependencies /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public
COPY --from=build /app/package*.json ./
COPY --from=build /app/next.config.js ./next.config.js
COPY --from=build /app/next-i18next.config.js ./next-i18next.config.js
# Add the wait script to the image
COPY --from=ghcr.io/ufoscout/docker-compose-wait:latest /wait /wait
# Add the ping api script to the image
COPY ./ping-api-to-load-model.js ./ping-api-to-load-model.js
# Expose the port the app will run on
EXPOSE 3000
# Start the application after the API is ready
CMD /wait && node ping-api-to-load-model.js && npm start