31 lines
1006 B
Docker
31 lines
1006 B
Docker
# Use Ubuntu 22.04 (LTS) as the base image to match production
|
|
FROM ubuntu:22.04
|
|
|
|
# Set environment variables to non-interactive to avoid prompts during installation
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Update package lists and install essential tools
|
|
# - curl: for downloading Node.js setup script
|
|
# - git: for version control operations
|
|
# - build-essential: for compiling native Node.js modules (node-gyp)
|
|
# - python3: required by some Node.js build tools
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
git \
|
|
build-essential \
|
|
python3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Node.js 20.x (LTS) from NodeSource
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
&& apt-get install -y nodejs
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Set default environment variables for development
|
|
ENV NODE_ENV=development
|
|
ENV NODE_OPTIONS='--max-old-space-size=8192'
|
|
|
|
# Default command keeps the container running so you can attach to it
|
|
CMD ["bash"] |