-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (28 loc) · 904 Bytes
/
Dockerfile
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
# Use Node.js 20 Alpine as base
FROM node:20-alpine
# Install required system packages
RUN apk add --no-cache curl
# Create app directory
WORKDIR /usr/src/app
# Copy package files first for better caching
COPY package.json ./
# Install dependencies
RUN npm install --production
# Copy all source files
COPY . .
# Create a non-root user
RUN addgroup -S appuser && adduser -S appuser -G appuser
# Change ownership of the app directory to the non-root user
RUN chown -R appuser:appuser /usr/src/app
ENV SERVER_JSON_LIMIT=1mb
ENV SERVER_URLENCODED_LIMIT=10mb
ENV SERVER_MAX_DOWNLOAD_SIZE_KB=1024
#ENV SERVER_ALLOWED_DOMAINS_FOR_DOWNLOAD="domain1.com,domain2.com,domain3.com"
USER appuser
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Start the server
CMD ["npm", "start"]