forked from dmitryplyaskin/SillyInnkeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (53 loc) · 1.87 KB
/
Copy pathDockerfile
File metadata and controls
76 lines (53 loc) · 1.87 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Stage 1: Build Client
FROM node:24-alpine AS client-builder
RUN corepack enable && corepack prepare yarn@4.12.0 --activate
WORKDIR /app
COPY SillyInnkeeper/package.json ./
COPY SillyInnkeeper/client ./client
WORKDIR /app/client
RUN yarn install --immutable
RUN yarn build
# Stage 2: Build Server
FROM node:24-alpine AS server-builder
RUN corepack enable && corepack prepare yarn@4.12.0 --activate
# Install build dependencies for native modules
RUN apk add --no-cache python3 make g++
WORKDIR /app/server
COPY SillyInnkeeper/server ./
RUN yarn install
RUN yarn build
# Stage 3: Production Runtime
FROM node:24-alpine
# Install runtime dependencies
RUN apk add --no-cache \
shadow \
python3 \
make \
g++ \
su-exec
RUN corepack enable && corepack prepare yarn@4.12.0 --activate
WORKDIR /app
# Copy server package files and install production dependencies
COPY SillyInnkeeper/server/package.json SillyInnkeeper/server/yarn.lock ./
RUN NODE_ENV=production yarn install
# Copy built artifacts
COPY --from=server-builder /app/server/dist ./server/dist
COPY --from=client-builder /app/client/dist ./client/dist
# Create data directory
RUN mkdir -p /app/data && chown node:node /app/data
# Environment variables
ENV NODE_ENV=production \
INNKEEPER_HOST=0.0.0.0 \
INNKEEPER_PORT=48912
EXPOSE 48912
# Create entrypoint script
RUN echo '#!/bin/sh' > /entrypoint.sh && \
echo 'PUID=${PUID:-1000}' >> /entrypoint.sh && \
echo 'PGID=${PGID:-1000}' >> /entrypoint.sh && \
echo 'echo "Running as UID:GID $PUID:$PGID"' >> /entrypoint.sh && \
echo 'groupmod -o -g "$PGID" node' >> /entrypoint.sh && \
echo 'usermod -o -u "$PUID" node' >> /entrypoint.sh && \
echo 'chown -R node:node /app/data' >> /entrypoint.sh && \
echo 'exec su-exec node node server/dist/server.js' >> /entrypoint.sh && \
chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]