mirror of
https://github.com/towfiqi/serpbear
synced 2025-06-26 18:15:54 +00:00
46 lines
1.3 KiB
Docker
46 lines
1.3 KiB
Docker
FROM node:lts-alpine AS deps
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
|
|
|
|
FROM node:lts-alpine AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app ./
|
|
RUN rm -rf /app/data
|
|
RUN rm -rf /app/__tests__
|
|
RUN rm -rf /app/__mocks__
|
|
RUN npm run build
|
|
|
|
|
|
FROM node:lts-alpine AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV production
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
RUN adduser --system --uid 1001 nextjs
|
|
RUN set -xe && mkdir -p /app/data && chown nextjs:nodejs /app/data
|
|
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
|
# COPY --from=builder --chown=nextjs:nodejs /app/data ./data
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
# setup the cron
|
|
COPY --from=builder --chown=nextjs:nodejs /app/cron.js ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/email ./email
|
|
COPY --from=builder --chown=nextjs:nodejs /app/database ./database
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.sequelizerc ./.sequelizerc
|
|
COPY --from=builder --chown=nextjs:nodejs /app/entrypoint.sh ./entrypoint.sh
|
|
RUN rm package.json
|
|
RUN npm init -y
|
|
RUN npm i cryptr dotenv croner @googleapis/searchconsole sequelize-cli
|
|
RUN npm i -g concurrently
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
CMD ["concurrently","node server.js", "node cron.js"] |