diff --git a/backend/Dockerfile b/backend/Dockerfile index 7da1ac8..796668e 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -12,13 +12,10 @@ RUN npm install --only=production --silent # Copy source code COPY . . -# Create non-root user -RUN addgroup -g 1001 -S nodejs -RUN adduser -S turftracker -u 1001 - -# Change ownership of the app directory -RUN chown -R turftracker:nodejs /app -USER turftracker +# Use the pre-created non-root user from the Node image +# and ensure ownership is correct +RUN chown -R node:node /app +USER node # Expose port EXPOSE 5000 @@ -28,4 +25,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ CMD node healthcheck.js # Start the application -CMD ["npm", "start"] \ No newline at end of file +CMD ["npm", "start"] diff --git a/frontend/Dockerfile b/frontend/Dockerfile index baa2c1d..97573bf 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -12,13 +12,10 @@ RUN npm install --silent # Copy source code COPY . . -# Create non-root user -RUN addgroup -g 1001 -S nodejs -RUN adduser -S turftracker -u 1001 - -# Change ownership of the app directory -RUN chown -R turftracker:nodejs /app -USER turftracker +# Use the pre-created non-root user from the Node image +# and ensure ownership is correct +RUN chown -R node:node /app +USER node # Expose port EXPOSE 3000