Skip to content

[Docs] Building container images#1708

Merged
gerhard merged 1 commit intodagger:mainfrom
helderco:build-images-doc
Mar 9, 2022
Merged

[Docs] Building container images#1708
gerhard merged 1 commit intodagger:mainfrom
helderco:build-images-doc

Conversation

@helderco
Copy link
Copy Markdown
Contributor

@helderco helderco commented Mar 8, 2022

Signed-off-by: Helder Correia

@helderco helderco requested a review from gerhard March 8, 2022 16:38
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 8, 2022

@gerhard gerhard mentioned this pull request Mar 8, 2022
13 tasks
Copy link
Copy Markdown
Member

@TomChv TomChv left a comment

Choose a reason for hiding this comment

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

Great explanation, that could be a good template as well for #1716.
I left a few comments to improve cue plan ;)

@helderco
Copy link
Copy Markdown
Contributor Author

helderco commented Mar 9, 2022

Thank you @TomChv for the feedback 🙂

I didn't know how ready alpine and go were. I think I saw something to that extent, but didn't look further because I needed to get something out the door and got back to basics.

I didn't test these as well, I just tried do convert from the Dockerfile examples in the Docker docs (see links in each section). But I want to fix this right away by implementing #1715.

I want the examples to be as short as possible, but still, at first I tried adapting from my personal use cases, but later I found better to convert from Docker's own examples. For sure, using the packages from universe is my intention, it'll help keep them shorter.

@gerhard
Copy link
Copy Markdown
Contributor

gerhard commented Mar 9, 2022

I really like the straightforward examples:

  • Dockerfile
  • multiple steps
  • templated
  • multi-stage

For the first two examples, I would use the python:3.9.10 image, instead of ubuntu:18.04.

For the third example, the official mysql image would be my suggestion.

For the multi-stage example, I don't think that the dir is relevant, and it doesn't look like a canonical go example to me. I would expect us to be using go modules for the dependencies, and maybe the latest version of go, most likely 1.17.

@helderco
Copy link
Copy Markdown
Contributor Author

helderco commented Mar 9, 2022

For the first two examples, I would use the python:3.9.10 image, instead of ubuntu:18.04.

I agree, it doesn't even have python, I just adapted from Docker docs, as I've said (https://docs.docker.com/develop/develop-images/dockerfile_best-practices/).

For the third example, the official mysql image would be my suggestion.

I wanted the official one too, but it doesn't have those env vars and so I adopted one of my actual use cases which is really simple. I'll see if I can do something that makes sense with the official image.

For the multi-stage example, I don't think that the dir is relevant, and it doesn't look like a canonical go example to me. I would expect us to be using go modules for the dependencies, and maybe the latest version of go, most likely 1.17.

Again, that was straight from Docker docs (https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds). I wanted to make it simpler so I'm refactoring with go and alpine packages from universe, abandoning the direct conversion from Docker docs, and just making it a simple go building example.

Initially I was using one of my own cases with a base image that produces a build image and a run image, but this Go example is simpler.

@helderco
Copy link
Copy Markdown
Contributor Author

helderco commented Mar 9, 2022

@gerhard updated

@helderco
Copy link
Copy Markdown
Contributor Author

helderco commented Mar 9, 2022

I'm going to remove the platform targeting, because I crossed my wires. It's useful if you want that built binary in your local machine, but that's another use case.

Copy link
Copy Markdown
Contributor

@gerhard gerhard left a comment

Choose a reason for hiding this comment

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

This looks great now 🚀

@gerhard gerhard merged commit b78be73 into dagger:main Mar 9, 2022
@gerhard gerhard deleted the build-images-doc branch March 9, 2022 17:28
@helderco helderco changed the title [Doc] Building container images [Docs] Building container images Mar 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants