This repository has been archived by the owner on Jul 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Use ARG environment variable as template system #67
Comments
robertgzr
added a commit
that referenced
this issue
Nov 10, 2021
This basically renders Dockerfile.template useless, since the same can be achieved using build args. We simply pass the same values to the docker build and let the user use them. This also includes TARGETPLATFORM, which buildx injects: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images Closes #67 Change-type: minor Signed-off-by: Robert Günzler <[email protected]>
robertgzr
added a commit
that referenced
this issue
Nov 10, 2021
This basically renders Dockerfile.template useless, since the same can be achieved using build args. We simply pass the same values to the docker build and let the user use them. This also includes TARGETPLATFORM, which buildx injects: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images A sample dockerfile could look like this: ``` ARG BALENA_MACHINE_NAME FROM balenalib/${BALENA_MACHINE_NAME}-alpine ARG BALENA_ARCH RUN do some thing with ${BALENA_ARCH} ``` Closes #67 Change-type: minor Signed-off-by: Robert Günzler <[email protected]>
robertgzr
added a commit
that referenced
this issue
Nov 10, 2021
This basically renders Dockerfile.template useless, since the same can be achieved using build args. We simply pass the same values to the docker build and let the user use them. This also includes TARGETPLATFORM, which buildx injects: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images A sample dockerfile could look like this: ``` ARG BALENA_MACHINE_NAME FROM balenalib/${BALENA_MACHINE_NAME}-alpine ARG BALENA_ARCH RUN do some thing with ${BALENA_ARCH} ``` Closes #67 Change-type: minor Signed-off-by: Robert Günzler <[email protected]>
robertgzr
added a commit
that referenced
this issue
Nov 12, 2021
This basically renders Dockerfile.template obsolete, since the same can be achieved using build args. We simply pass the same values to the docker build and let the user use them. This also includes TARGETPLATFORM, which buildx injects: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images A sample dockerfile could look like this: ``` ARG BALENA_MACHINE_NAME FROM balenalib/${BALENA_MACHINE_NAME}-alpine ARG BALENA_ARCH RUN do some thing with ${BALENA_ARCH} ``` Closes #67 Change-type: minor Signed-off-by: Robert Günzler <[email protected]>
robertgzr
added a commit
that referenced
this issue
Nov 12, 2021
This basically renders Dockerfile.template obsolete, since the same can be achieved using build args. We simply pass the same values to the docker build and let the user use them. This also includes TARGETPLATFORM, which buildx injects: https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images A sample dockerfile could look like this: ``` ARG BALENA_MACHINE_NAME FROM balenalib/${BALENA_MACHINE_NAME}-alpine ARG BALENA_ARCH RUN do some thing with ${BALENA_ARCH} ``` Closes #67 Change-type: minor Signed-off-by: Robert Günzler <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi!
I'm in the Barcelona 2019 Hackaton, I've been speaking with some of your developers and I've been advised to post this issue here.
Regarding the template system implemented in your platform, to be able to build Docker images for several boards, i. e. Raspberry Pi 2 or 3 at the same time, documented here: https://www.balena.io/docs/learn/develop/dockerfile/; I believe it should be fully compatible with the new standard ARG environments variables in FROM statements during the build time of a docker image. Which is documented here: https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
Take into account the example Dockerfile given by this repo: https://github.com/balena-io-playground/balena-sense-hat-python-starter/blob/master/Dockerfile
FROM resin/raspberrypi3-debian:latest
This FROM statement works locally and remotely for Raspberry Pi 3 images, if we want to use this Dockerfile in different machines, we should implement your template system:
FROM resin/%%BALENA_MACHINE_NAME%%-debian:latest
And consequently rename
Dockerfile
toDockerfile.template
, that would make this Dockerfile not complience with Docker standards.One would expect that
BALENA_MACHINE_NAME
would be present as a environment variable as build time during your building, thus,would work, but it does not! The best approach I've currently found it is something like this:
Using a
Dockerfile.template
as a Dockerfile and it is both compatible with Docker cli and your template system.The text was updated successfully, but these errors were encountered: