diff --git a/docs/core-concepts/1205-container-images.md b/docs/core-concepts/1205-container-images.md index 0eb9d358..533519f5 100644 --- a/docs/core-concepts/1205-container-images.md +++ b/docs/core-concepts/1205-container-images.md @@ -7,21 +7,21 @@ displayed_sidebar: europa You can use Dagger to build container images. Here's a simple example of a [Dockerfile](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) build: -```cue file=../tests/core-concepts/container-images/plans/with-dockerfile.cue +```cue file=../tests/core-concepts/container-images/simple/with-dockerfile.cue ``` ## Building with CUE `Dockerfile` files are easy to start, but you can also build images entirely in CUE. The following example produces the same image as above: -```cue file=../tests/core-concepts/container-images/plans/build.cue +```cue file=../tests/core-concepts/container-images/simple/build.cue ``` ## Automation Building images in CUE gives you greater flexibility. For example, you can automate building multiple versions of an image, and deploy, all in Dagger: -```cue file=../tests/core-concepts/container-images/plans/template.cue +```cue file=../tests/core-concepts/container-images/template/dagger.cue ``` Now you can deploy all versions: @@ -40,5 +40,5 @@ dagger do versions 8.0 build Another common pattern is [multi-stage builds](https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds). This allows you to have heavier build images during the build process, and copy the built artifacts into a cleaner and lighter image to run in production. -```cue file=../tests/core-concepts/container-images/plans/multi-stage.cue +```cue file=../tests/core-concepts/container-images/multi-stage/dagger.cue ``` diff --git a/docs/tests/core-concepts/container-images/plans/multi-stage.cue b/docs/tests/core-concepts/container-images/multi-stage/dagger.cue similarity index 87% rename from docs/tests/core-concepts/container-images/plans/multi-stage.cue rename to docs/tests/core-concepts/container-images/multi-stage/dagger.cue index acd3c693..a544951c 100644 --- a/docs/tests/core-concepts/container-images/plans/multi-stage.cue +++ b/docs/tests/core-concepts/container-images/multi-stage/dagger.cue @@ -8,12 +8,12 @@ import ( ) dagger.#Plan & { - client: filesystem: src: read: contents: dagger.#FS + client: filesystem: "./src": read: contents: dagger.#FS actions: { // Build app in a "golang" container image. build: go.#Build & { - source: client.filesystem.src.read.contents + source: client.filesystem."./src".read.contents } base: alpine.#Build & { diff --git a/docs/tests/core-concepts/container-images/plans/src/app.go b/docs/tests/core-concepts/container-images/multi-stage/src/app.go similarity index 100% rename from docs/tests/core-concepts/container-images/plans/src/app.go rename to docs/tests/core-concepts/container-images/multi-stage/src/app.go diff --git a/docs/tests/core-concepts/container-images/plans/src/go.mod b/docs/tests/core-concepts/container-images/multi-stage/src/go.mod similarity index 100% rename from docs/tests/core-concepts/container-images/plans/src/go.mod rename to docs/tests/core-concepts/container-images/multi-stage/src/go.mod diff --git a/docs/tests/core-concepts/container-images/plans/build.cue b/docs/tests/core-concepts/container-images/simple/build.cue similarity index 79% rename from docs/tests/core-concepts/container-images/plans/build.cue rename to docs/tests/core-concepts/container-images/simple/build.cue index 21dd39b4..baacaa5a 100644 --- a/docs/tests/core-concepts/container-images/plans/build.cue +++ b/docs/tests/core-concepts/container-images/simple/build.cue @@ -6,7 +6,7 @@ import ( ) dagger.#Plan & { - client: filesystem: ".": read: contents: dagger.#FS + client: filesystem: "./src": read: contents: dagger.#FS actions: build: docker.#Build & { steps: [ @@ -14,7 +14,7 @@ dagger.#Plan & { source: "python:3.9" }, docker.#Copy & { - contents: client.filesystem.".".read.contents + contents: client.filesystem."./src".read.contents dest: "/app" }, docker.#Run & { diff --git a/docs/tests/core-concepts/container-images/simple/src/app.py b/docs/tests/core-concepts/container-images/simple/src/app.py new file mode 100644 index 00000000..f1a18139 --- /dev/null +++ b/docs/tests/core-concepts/container-images/simple/src/app.py @@ -0,0 +1 @@ +print("Hello world!") diff --git a/docs/tests/core-concepts/container-images/simple/src/requirements.txt b/docs/tests/core-concepts/container-images/simple/src/requirements.txt new file mode 100644 index 00000000..e69de29b diff --git a/docs/tests/core-concepts/container-images/plans/with-dockerfile.cue b/docs/tests/core-concepts/container-images/simple/with-dockerfile.cue similarity index 71% rename from docs/tests/core-concepts/container-images/plans/with-dockerfile.cue rename to docs/tests/core-concepts/container-images/simple/with-dockerfile.cue index 0e190eda..ec9849af 100644 --- a/docs/tests/core-concepts/container-images/plans/with-dockerfile.cue +++ b/docs/tests/core-concepts/container-images/simple/with-dockerfile.cue @@ -5,15 +5,15 @@ import ( ) dagger.#Plan & { - client: filesystem: ".": read: contents: dagger.#FS + client: filesystem: "./src": read: contents: dagger.#FS actions: build: dagger.#Dockerfile & { // This is the context. - source: client.filesystem.".".read.contents + source: client.filesystem."./src".read.contents // Default is to look for a Dockerfile in the context, // but let's declare it here. - contents: #""" + dockerfile: contents: #""" FROM python:3.9 COPY . /app RUN pip install -r /app/requirements.txt diff --git a/docs/tests/core-concepts/container-images/plans/template.cue b/docs/tests/core-concepts/container-images/template/dagger.cue similarity index 100% rename from docs/tests/core-concepts/container-images/plans/template.cue rename to docs/tests/core-concepts/container-images/template/dagger.cue