Skip to content

Commit 89a691b

Browse files
committed
containerize_frontend_component/#392
Signed-off-by: Noa <[email protected]>
1 parent b2bee1d commit 89a691b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

workspaces/frontend/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Ignore node_modules to speed up build and avoid copying local dependencies
2+
node_modules

workspaces/frontend/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Development base image
2+
FROM node:20
3+
4+
# Set working directory inside the container
5+
WORKDIR /usr/src/app
6+
7+
# Copy only package files first to install dependencies
8+
COPY package*.json ./
9+
10+
# Install all dependencies (including devDependencies)
11+
RUN npm install
12+
13+
# Copy the rest of the frontend source code to the container
14+
COPY . .
15+
16+
# Use a non-root user for security
17+
RUN addgroup --system appgroup && adduser --system appuser --ingroup appgroup
18+
USER appuser
19+
20+
# Expose the development port (matching webpack dev server)
21+
EXPOSE 9000
22+
23+
# Define environment variables
24+
ENV PORT=9000
25+
ENV ENV=development
26+
27+
28+
# Run the development server with live-reload
29+
CMD ["npm", "run", "start:dev"]

0 commit comments

Comments
 (0)