File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ - Create a non root user in Docker Image and move app out of root dir ([ #91 ] ( https://github.com/hasura/ndc-elasticsearch/pull/91 ) )
11+
1012## [ 1.9.2]
1113
1214- Patch for broken release v1.9.1
Original file line number Diff line number Diff line change @@ -15,19 +15,29 @@ FROM alpine:3
1515# Install necessary certificates for the application to run
1616RUN apk --no-cache add ca-certificates
1717
18- # Set the working directory inside the container
19- WORKDIR /root/
18+ # Create a safe working directory
19+ WORKDIR /app
2020
2121RUN mkdir -p /etc/connector
2222
2323# Copy the Go binary from the builder stage
2424COPY --from=builder /app/ndc-elasticsearch .
2525
26- # Expose the port on which the service will run
26+ # Create non-root user with UID and GID 1001
27+ RUN addgroup -g 1001 hasura && \
28+ adduser -u 1001 -G hasura -D hasura && \
29+ chown 1001:1001 /app/ndc-elasticsearch && \
30+ chmod 755 /app/ndc-elasticsearch
31+
32+ # Use the non-root user
33+ USER 1001
34+
35+ # Expose port
2736EXPOSE 8080
2837
38+ # Set env if needed
2939ENV HASURA_CONFIGURATION_DIRECTORY=/etc/connector
3040
31- # Run the web service on container startup.
32- ENTRYPOINT [ "./ ndc-elasticsearch" ]
33- CMD [ "serve" ]
41+ # Run the app
42+ ENTRYPOINT ["/app/ ndc-elasticsearch" ]
43+ CMD ["serve" ]
You can’t perform that action at this time.
0 commit comments