Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Docker related improvements #134

Merged
merged 2 commits into from
Oct 4, 2022
Merged

feat: Docker related improvements #134

merged 2 commits into from
Oct 4, 2022

Conversation

scop
Copy link
Contributor

@scop scop commented Oct 3, 2022

No description provided.

Using the build image as the final one retains things in the image
that's not needed at runtime, for example source code and build cache
including dependencies.

Additionally, the `golang:1.18` image contains the entire Go SDK as well
as other software needed for building things, such as compilers etc,
that are not needed at vacuum image runtime either.

Use `debian:bullseye-slim` as the base image to fix both issues. Brings
down size of the final image from 1.16GB to 107MB.

We could conceivably use an even smaller base image for the final one
than that, but we end up having some native lib dependencies in the
binary; thus `scratch` as basis won't work. And as that's the case, it's
safer to use the same basis as the `golang:1.18` build image does (it's
currently based on Debian Bullseye) rather than jump to something
completely different (such as e.g. Alpine based one).
Just `docker dshanley/vacuum lint` isn't enough, at least the OpenAPI
spec needs to be mounted in the container for it to be available.

Also, running a container off the image needs the `run` argument, and
`--rm` is most likely what most people want.

We now mount the base directory rather than just the top level spec file
provides for finding referenced schemas in case they are in the same
subdir tree. `/work` is set as the default working dir for the image,
and is where the tree with the spec should be mounted at.

While at it, consolidate/clarify instructions related to Docker Hub vs
GHCR.
Copy link
Owner

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you for your contribution, thank you for making vacuum better.

@daveshanley daveshanley added the release/patch Patch / non-breaking release label Oct 4, 2022
@daveshanley daveshanley merged commit 93d1168 into daveshanley:main Oct 4, 2022
@scop scop deleted the feat/docker-improvements branch October 5, 2022 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/patch Patch / non-breaking release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants