The issue was how I was copying my file structure in this part:
# Copy source code and build
COPY --from=dependencies /app/node_modules ./node_modules
COPY package.json eslint.config.mjs tsconfig.json ./
COPY . ./frontend
RUN npm run build frontend
I was changing the application structure to try and help with caching, but this wasn't actually necessary and was just causing too many problems. Updating it to this:
# Copy source code and build
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN npm run build
and changing the rest of the Dockerfile accordingly resolved the issue.