-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[WIP] Github Action with docker to build the firmware #1045
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
Conversation
…ide the Github Action job.
…s instead of a single .zip file.
…e 2nd is needed because github actions do not support the USER instruction. I published the images in my docker account and edited the documentation accordingly
|
I've just pushed a new commit that duplicates the Dockerfile
That's a pity I had to duplicate the docker files, but I couldn't find any other solution... |
|
Thanks to @NeroBurner, we may have found a solution to the duplication of Dockerfile. With this command: the "github" docker (the one that does not use the Do you think it's ok to add those |
|
Short answer: yes I think it is OK (although no docker expert, I just pieced this solution together to the point where it works)
the bind mounts of Long answer: a possible security implication against the mounting of |
|
Great, thanks @NeroBurner ! |
|
you don't need to have a user and group for Also, even if you do need passwd and group, why would you need shadow? |
|
for Yes, you're probably right about |
exactly - but you don't need to know the user:userid translations (passwd) or who is in each group (group), so long as you pass the correct ones. and just as you can pass in the username, you can pass in the user. (for example: the environment variable
it's better (I think) in this case to allow the docker "user" to use sudo without needing a password then letting it use your password. (this can be done with [1] sudoers tends to have |
|
Actually, a simpler solution when shadow is really needed - create a new one. (which can even be a copy of one that worked - but not you passwords (hashes, bu nonetheless)) |
|
In this case, I don't think we need |
in that case, just used the uid and gid. (pass them in via env variable or some such[1], and set them to 0 (root) otherwise.) [1] for example, assume that the source files have the correct permissions, and use that as a reference. |
|
If I understand correctly, this would be better to run the container as a user instead of root.
So... it should just work without mounting /etc/passwd, /etc/group and /etc/shadow, right? Notice that the build directly belongs to jf:jf, which is my local user/group. Would this be an acceptable solution? |
not my PR, (or my project), so I really don't have any say in the matter - but security wise, it is. |
But you're still free to provide your expertise 👍 Thanks! |
… computer using the following command line : docker run --rm -it -v ${PWD}:/sources -u $(id -u ${USER}):$(id -g ${USER}) jf002/infinitime-build.
|
With the last commit, the same Docker image can be used on my computer and on Github Action. I pushed an updated Docker image to DockerHub (https://hub.docker.com/repository/registry-1.docker.io/jf002/infinitime-build/tags). It's built for X86_64 and ARM64. Sooo... Are we ready to switch the CI to Docker-inside-GitHubActions? |
|
I think it's almost ready, but I've noticed that the actions run on this PR didn't upload a DFU file, it says it couldn't find it. Maybe the location that it looks for the files needs to be changed, or the location the docker image puts its output need to be mounted on the "host"? |
Thanks for checking! It looks like there's an issue with the artifacts, indeed. I'll have a look at this asap! |
|
@FintasticMan It should be fixed, but I don't know why, the workflow was not triggered... |
# Conflicts: # .github/workflows/main.yml # docker/Dockerfile
|
Ok, I don't know what happened here, I've probably failed a merge commit or something, and this branch reverts changes that were made 2 months ago in nimble_port_freertos.c. |
In this PR, I'm experimenting with Docker running inside the Github Action CI. My goal is to use the very same container for my local builds and for Github Actions. That way, we ensure that everyone who use the docker container AND github actions will produce the same output.
Another advantage is that we'll avoid duplicating the build system in Docker and Github Action YML file.
Here's what I did:
.path in Github Action.TODO:
USERcommand in the Docker file. The container in this PR runs as root, and create thebuildfolder as root too. The original container runs as a normal user, which allows the user on the host to write/delete the build directory. When the container runs as root, users on the host cannot write and delete the build folder. Is there any solution to this? (Maybe fixed here