bldg14 / eventual

A simple event calendar
https://eventual-client.fly.dev
MIT License
0 stars 0 forks source link

update Dockerfile.server to use distroless image #42

Closed kevinfalting closed 11 months ago

kevinfalting commented 11 months ago

Overview

Updated the image to use a distroless image instead of FROM scratch.

Related Issues / PRs

Resolves: #41

Thought Process

Looking into this more, people have already done the work of creating a bare minimum image that just needs a binary placed in it to run. These are well supported and are kept up to date.

I've updated the builder stage to just build the binary, and then the distroless stage just copies it over, and set's the user to be a non-root user. No need to copy over timezone data or certs, they already exist.

I tried to take advantage of how the layers are built and caching, so I've set each command in the file to work from least likely to change, to most likely.

Testing Steps

docker build -t eventual-server .
docker run -it --rm eventual-server
curl localhost:8080/api/v1/events

or deploy to fly:

flyctl deploy --remote-only --config ./fly.server.toml

Risks

Low risk, this should harden the image.

vercel[bot] commented 11 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
eventual ✅ Ready (Inspect) Visit Preview Sep 8, 2023 9:24pm