forked from yorknouse/website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.react-local-df
More file actions
56 lines (36 loc) · 1.12 KB
/
Copy pathDockerfile.react-local-df
File metadata and controls
56 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM node:24-slim AS build
RUN apt-get update -y && apt-get install -y openssl
WORKDIR /app
COPY ./edit-backend/package*.json ./
RUN npm install
COPY ./edit-backend/prisma /app/prisma
RUN npm install @prisma/client
RUN npx prisma generate
COPY ./edit-backend /app
RUN npm run build
# Compile cron script
# Make sure tsconfig.cron.json exists in project root
RUN npx tsc -p tsconfig.cron.json
FROM node:24-slim AS runtime
RUN apt-get update -y && apt-get install -y cron openssl
WORKDIR /app
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public
COPY --from=build /app/prisma ./prisma
COPY --from=build /app/dist ./dist
COPY --from=build /app/package*.json ./
COPY --from=build /app/next.config.ts ./
ENV PORT=3000
ENV HOST=0.0.0.0
EXPOSE 3000
# Create cron log file
RUN touch /var/log/cron.log
# Add cron job
COPY docker/nextjs-cron /etc/cron.d/nextjs-cron
# Set permissions
RUN chmod 0644 /etc/cron.d/nextjs-cron
# Apply cron job
RUN crontab /etc/cron.d/nextjs-cron
# Start cron in background and then start Next.js server
CMD cron && npm run start