Skip to content

Commit

Permalink
Refactor Dockerfile for security and SonarQube quality standards.
Browse files Browse the repository at this point in the history
Dockerfile to align with best practices for security and SonarQube quality standards.
  • Loading branch information
akiltipu authored Mar 11, 2024
1 parent 7f23fdd commit 7e78bfd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# Use a lightweight base image with OpenJDK 8
FROM openjdk:8u151-jdk-alpine3.7

# Set a non-root user for running the application
RUN adduser -D imagebuilder
USER imagebuilder

# Expose the port on which the application will run
EXPOSE 8070

# Copy the JAR file to the /usr/app directory
COPY target/shopping-cart*.jar /usr/app/

# Set the working directory to /usr/app
WORKDIR /usr/app

CMD java -jar shopping-cart*.jar
# Run the application using a non-root user
CMD ["java", "-jar", "shopping-cart*.jar"]

0 comments on commit 7e78bfd

Please sign in to comment.