Last active
September 27, 2024 13:55
-
-
Save reitzig/4a1cccc965b50a15868fb345d770cdec to your computer and use it in GitHub Desktop.
MWE: docker-compose.yaml with build arguments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" | |
services: | |
foo: | |
build: | |
context: . | |
# dockerfile: Dockerfile # in case you were not using the default | |
args: | |
foo: "some foo!" | |
image: foo-repro | |
container_name: foo-repro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu | |
ARG foo="setme" | |
# Available at build time: | |
RUN echo foo=${foo} > foo | |
# Need to "convert" into environment variable so it's available at runtime: | |
ENV FOO ${foo} | |
CMD [ "sh", "-c", "cat foo; echo FOO=${FOO}" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with