From 57fddd2a9af496504a07d3f19ab695df8b34f330 Mon Sep 17 00:00:00 2001 From: Cliff Hill Date: Wed, 20 Aug 2025 20:43:45 -0400 Subject: [PATCH] Working on getting the dev/local operating. Signed-off-by: Cliff Hill --- compose.dev.yml | 4 +--- frontend/Dockerfile | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/compose.dev.yml b/compose.dev.yml index 3623c30e..658cde25 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -21,14 +21,13 @@ services: retries: 3 security_opt: - no-new-privileges:true - user: "1000:1000" # Non-root user frontend: extends: file: compose.yml service: frontend volumes: - - ./frontend/src:/app/src + - ./frontend/build:/app/build - ./frontend/package.json:/app/package.json - ./frontend/yarn.lock:/app/yarn.lock command: ["yarn", "start"] @@ -45,7 +44,6 @@ services: retries: 3 security_opt: - no-new-privileges:true - user: "1000:1000" # Non-root user postgres: extends: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index c6c6d1bf..0dfe0e8b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,5 +1,18 @@ +# Dockerfile for building and serving a React application using TypeScript +# This Dockerfile uses a multi-stage build to keep the final image size small. +# It builds the application in a Node.js environment and serves it using a lightweight server. + +# The User ID can be passed as a build argument to run the container as a non-root user. +ARG USER_ID=$(id -u) + +# The Node.js version can be passed as a build argument. +ARG NODE_VERSION=24.6.0 + # Build stage -FROM node:24.6.0 AS builder +FROM node:${NODE_VERSION} AS builder + +# Set the User ID for non-root user +USER ${USER_ID} # Setting working directory for build WORKDIR /app @@ -23,7 +36,10 @@ COPY . . RUN yarn run build # Production stage -FROM node:24.6.0-slim +FROM node:${NODE_VERSION}-slim + +# Set the User ID for non-root user +USER ${USER_ID} # Setting working directory for build WORKDIR /app