forked from Emmanuel-Rods/SnapBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 1.04 KB
/
Copy pathDockerfile
File metadata and controls
41 lines (30 loc) · 1.04 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
# Puppeteer-maintained base image with all deps
FROM ghcr.io/puppeteer/puppeteer:latest
# App directory
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci --omit=dev
# Copy source
COPY . .
ENV NODE_ENV=production \
LOG_LEVEL=info \
LOG_FILE=/app/logs/app.log \
PORT=3000 \
COOKIES_DIR=/app/data/cookies
# Prepare data/log/media directories
RUN mkdir -p /app/media /app/data/cookies /app/logs && chown -R pptruser:pptruser /app
# Non-root user provided by the base image
USER pptruser
EXPOSE 3000
# Install curl for healthcheck
USER root
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
USER pptruser
# Volumes for media, cookies, and logs
VOLUME ["/app/media", "/app/data/cookies", "/app/logs"]
# Healthcheck against API
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD curl -sf http://localhost:${PORT:-3000}/health || exit 1
# Run migrations then start API server
CMD ["sh", "-lc", "node scripts/migrate.js && node api/server.js"]