forked from juitnow/juit-pgproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (31 loc) · 1020 Bytes
/
Copy pathDockerfile
File metadata and controls
41 lines (31 loc) · 1020 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
# Use Node.js 22 as specified in rules
FROM node:22-alpine
# Install necessary system dependencies for libpq
RUN apk add --no-cache \
postgresql-dev \
python3 \
make \
g++ \
git
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json ./
COPY workspaces ./workspaces
# Install dependencies
RUN npm ci --only=production
# Build the project
RUN npm run build
# Create a non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S pgproxy -u 1001
# Change ownership of the app directory
RUN chown -R pgproxy:nodejs /app
USER pgproxy
# Expose the default port (can be overridden with PGPROXYPORT env var)
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "require('http').get('http://localhost:${PGPROXYPORT:-8080}${PGPROXYHEALTHCHECK:-/health}', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"
# Default command
CMD ["node", "workspaces/cli/dist/cli.mjs"]