-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (31 loc) · 985 Bytes
/
Dockerfile
File metadata and controls
43 lines (31 loc) · 985 Bytes
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
# Use Node.js 20 Alpine as base image
FROM node:20-alpine
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apk add --no-cache \
postgresql-client \
curl \
bash \
&& rm -rf /var/cache/apk/*
# Copy package files first for better caching
COPY package*.json ./
# Install all dependencies first (including dev dependencies for tsx)
RUN npm ci
# Copy source code
COPY . .
# Build the application for production
RUN npm run build
# Clean up dev dependencies and reinstall production + tsx
RUN npm ci --only=production && npm install tsx
# Create uploads directory
RUN mkdir -p uploads
# Make sure the entrypoint script is executable and in the right place
RUN chmod +x docker-entrypoint.sh
# Expose port
EXPOSE 5000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:5000/api/health || exit 1
# Use bash to run the entrypoint script
CMD ["bash", "/app/docker-entrypoint.sh"]