forked from BastianGanze/weebsync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
65 lines (49 loc) · 1.78 KB
/
Dockerfile.dev
File metadata and controls
65 lines (49 loc) · 1.78 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
# syntax=docker/dockerfile:1
# Development Dockerfile optimized for hot-reload and debugging
ARG NODE_VERSION=22-alpine
# --- Base Development Stage ---
FROM node:${NODE_VERSION} AS dev-base
# Install system dependencies for development and setup Python
RUN apk add --no-cache \
bash \
curl \
dumb-init \
git \
py3-pip \
python3 && \
rm -f /usr/lib/python*/EXTERNALLY-MANAGED
# Set working directory
WORKDIR /app
# --- Development Dependencies Stage ---
FROM dev-base AS dev-deps
# Copy package files for better layer caching
COPY package.json yarn.lock ./
COPY client/package.json ./client/
COPY server/package.json ./server/
# Install all dependencies (including devDependencies) with cache mount
RUN --mount=type=cache,target=/root/.yarn \
--mount=type=cache,target=/root/.cache \
yarn install --frozen-lockfile
# --- Final Development Stage ---
FROM dev-base AS development
# Copy dependencies from dev-deps stage
COPY --from=dev-deps /app/node_modules ./node_modules
COPY --from=dev-deps /app/client/node_modules ./client/node_modules
COPY --from=dev-deps /app/server/node_modules ./server/node_modules
# Copy source files (will be overridden by volume mounts in docker-compose)
COPY . .
# Create necessary directories
RUN mkdir -p /app/build /app/config /app/plugins
# Development environment variables
ENV NODE_ENV=development
ENV DEBUG=weebsync:*
# Create non-root user for security (optional in dev, but good practice)
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 && \
chown -R nodejs:nodejs /app
# Switch to non-root user
USER nodejs
# Use dumb-init for proper signal handling
ENTRYPOINT ["dumb-init", "--"]
# Default command (will be overridden by docker-compose)
CMD ["sh", "-c", "echo 'Development container ready. Override with docker-compose command.'"]