diff --git a/Dockerfile b/Dockerfile index e10dcdd..5c27e7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,15 +32,22 @@ FROM base AS production # Set a non-root user for security RUN addgroup -S appgroup && adduser -S appuser -G appgroup -USER appuser # Copy only the necessary files from the previous stages COPY --from=build /usr/src/app/node_modules ./node_modules +COPY --from=build /usr/src/app/views ./views COPY --from=build /usr/src/app/static ./static COPY --from=build /usr/src/app/lib ./lib COPY --from=build /usr/src/app/server.js . COPY --from=build /usr/src/app/config.json . +# Create the data directory and set correct permissions +# This is the FIX for the EACCES error +RUN mkdir -p data && chown -R appuser:appgroup . + +# Switch to the non-root user +USER appuser + # Expose the port the app runs on EXPOSE 8080