-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile.dev.example
More file actions
35 lines (27 loc) · 997 Bytes
/
Copy pathdockerfile.dev.example
File metadata and controls
35 lines (27 loc) · 997 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
# Category: Dev
# Service: NodeJS Development Dockerfile
# Description: Development environment for Next.js with volume mounting and hot reloading.
# Maintainer: ryumada
# STAGE 0: Base image with system dependencies (Cached)
FROM node:${DOCKER_NODEJS_TAG} AS base
RUN apk add --no-cache libc6-compat python3 make g++ shadow
# STAGE 1: Development environment
FROM base AS dev
# Add user and group with matching IDs from the host to fix permissions
ARG HOST_USER_ID
ARG HOST_GROUP_ID
RUN groupmod -g ${HOST_GROUP_ID} node
RUN usermod -u ${HOST_USER_ID} node
USER node
WORKDIR /usr/src/app
# Hardening: Disable Next.js telemetry
ENV NEXT_TELEMETRY_DISABLED=1
# Copy package files first to leverage Docker cache
COPY --chown=node:node app/${APP_NAME}/package.json app/${APP_NAME}/package-lock.json ./
RUN npm ci
# Copy application source code
COPY --chown=node:node app/${APP_NAME} ./
# Expose port for Next.js dev server
EXPOSE 3000
# Start the development server
CMD ["npm", "run", "dev"]