forked from qazzxxx/cloudimgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.gha
More file actions
52 lines (38 loc) · 1.63 KB
/
Dockerfile.gha
File metadata and controls
52 lines (38 loc) · 1.63 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
# GitHub Actions optimized Dockerfile (aligned with packages/server architecture)
FROM node:22-alpine AS builder
WORKDIR /app
RUN apk add --no-cache python3 make g++
ENV NODE_OPTIONS="--max-old-space-size=4096"
ENV NPM_CONFIG_AUDIT=false
ENV NPM_CONFIG_FUND=false
ENV NPM_CONFIG_PROGRESS=false
ENV NPM_CONFIG_LOGLEVEL=warn
COPY packages/server/package*.json ./packages/server/
RUN cd packages/server && npm ci --no-audit --no-fund --prefer-offline --legacy-peer-deps
COPY client-vue/package*.json ./client-vue/
RUN cd client-vue && npm ci --no-audit --no-fund --prefer-offline --legacy-peer-deps
COPY . .
RUN cd packages/server && npm run build
RUN cd client-vue && npm run build
FROM node:22-alpine AS production
WORKDIR /app
RUN apk add --no-cache su-exec
COPY --from=builder /app/packages/server/package*.json ./packages/server/
COPY --from=builder /app/packages/server/node_modules ./packages/server/node_modules
COPY --from=builder /app/packages/server/dist ./packages/server/dist
COPY --from=builder /app/client-vue/dist ./client-vue/dist
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
RUN mkdir -p /app/uploads /app/logs /app/data
EXPOSE 3003
ENV NODE_ENV=production
ENV PORT=3003
ENV STORAGE_PATH=/app/uploads
ENV DATABASE_URL=/app/data/cloudimgs.db
ENV PUID=1000
ENV PGID=1000
ENV UMASK=002
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:3003/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["node", "packages/server/dist/index.js"]