jenkins-x / jx-cdevents-adapter

CDEvents adapter for Jenkins X WIP
Apache License 2.0
2 stars 3 forks source link

Optimise Dockerfile #4

Open bradmccoydev opened 1 year ago

bradmccoydev commented 1 year ago

Optimize Dockerfile to be better with size and security.

FROM cgr.dev/chainguard/wolfi-base:latest

COPY --from=build /jx-cdevents-adapter /jx-cdevents-adapter
    EXPOSE 80

# required for external tools to detect this as a go binary
ENV GOTRACEBACK=all

ENTRYPOINT [ "./jx-cdevents-adapter" ]
Kalpesh-18 commented 1 year ago

Hello, is this an open issue? I would be happy to work on it

bradmccoydev commented 1 year ago

Yes i have assigned to you!

Kalpesh-18 commented 1 year ago

Hey, thanks for the assigning the issue. It would be great if you could briefly describe what you mean when you mention "optimized and better security."

i-am-yuvi commented 1 year ago

I guess no one is working, Can I work on it?

bradmccoydev commented 1 year ago

Hey @i-am-yuvi sure no problem

i-am-yuvi commented 1 year ago

Hey @bradmccoydev, I would like to suggest some changes:

  1. How about using a more lightweight base image golang:1.16-alpine3.14 which will eventually reduce the size of docker image
  2. We can also run the application as the non-root user to reduce the vulnerabilities that could occur if it run as a root user.
i-am-yuvi commented 1 year ago

# Add a new user RUN adduser -D myuser