-
Notifications
You must be signed in to change notification settings - Fork 89
Add Dockerfile and devcontainer.json #174
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
Changes from all commits
c7a841a
65db236
20ba726
fd91208
eb8e6da
3dcb80c
b0a10aa
9f715de
99585fe
2a188e6
c194851
8d1224f
dfe0445
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| # Install apt dependencies | ||
| ARG DEBIAN_FRONTEND=noninteractive | ||
| ARG NODE_MAJOR=20 | ||
| RUN apt-get update -qq \ | ||
| && apt-get install -y \ | ||
| curl \ | ||
| cmake \ | ||
| ccache \ | ||
| libsdl2-dev \ | ||
| g++ \ | ||
| gdb \ | ||
| git \ | ||
| libpng-dev \ | ||
| ninja-build \ | ||
| sudo \ | ||
| python3-pip \ | ||
| python3-venv \ | ||
| && rm -rf /var/cache/apt/* /var/lib/apt/lists/* | ||
|
|
||
| # Install nodejs based dependencies | ||
| RUN curl -sL https://deb.nodesource.com/setup_${NODE_MAJOR}.x -o nodesource_setup.sh \ | ||
| && bash nodesource_setup.sh \ | ||
| && apt-get update -qq \ | ||
| && apt-get install -y nodejs \ | ||
| && npm install -g \ | ||
| lv_font_conv@1.5.2 \ | ||
| && rm nodesource_setup.sh \ | ||
| && rm -rf /var/cache/apt/* /var/lib/apt/lists/* | ||
|
|
||
| # Install Python dependencies | ||
| RUN pip install --break-system-packages \ | ||
| wheel \ | ||
| Pillow \ | ||
| && pip cache purge | ||
|
|
||
| # The user ubuntu already exists set its password to ubuntu and add to sudo group for developing in devcontainer | ||
| RUN usermod -aG sudo ubuntu \ | ||
| && echo "ubuntu:ubuntu" | chpasswd | ||
|
|
||
| # Persist bash history across container rebuilds | ||
| # Reference: https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history | ||
| ARG USERNAME=ubuntu | ||
| RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \ | ||
| && mkdir /commandhistory \ | ||
| && touch /commandhistory/.bash_history \ | ||
| && chown -R $USERNAME /commandhistory \ | ||
| && echo "$SNIPPET" >> "/home/$USERNAME/.bashrc" | ||
|
|
||
| USER ubuntu | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should have tried this earlier. But still. Adding the I get the following: $ podman run --rm -it -v ${PWD}:/sources infinisim-build
CMake Error: Unable to (re)create the private pkgRedirects directory:
/sources/build/CMakeFiles/pkgRedirectsRemoving the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @NeroBurner I am not familiar with podman, I have only used Docker so far. I guess you have a permission issue. You bind mount the sources into the container, which will keep the UID and GID from your local user. Everything inside the container runs as the ubuntu user, which likely has a different UID and GID than the local user. So the processes inside the container can't write to /sources due to missing permissions.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When running inside the container (without the So I'd like to remove the could you try that out if that would work (as I don't have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have tested the following after removing the
Good results and all use cases still work.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. awesome! thanks for checking! 🙇 would you be willing to open a PR and update the readme and docker container? if not it's also OK as you were already very helpful!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I can do that. Edit: Done, please check #178 |
||
|
|
||
| # Section for interactive compilation during docker run | ||
|
|
||
| WORKDIR /sources | ||
| # Directory if InfiniTime source code | ||
dariusarnold marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ENV InfiniTime_DIR="/sources/InfiniTime" | ||
| # Passed to CMake generate step | ||
| ENV GENERATE_ARGS="" | ||
| # Passed to CMake build step | ||
| ENV BUILD_ARGS="" | ||
| # Build directory | ||
| ENV BUILD_DIRECTORY="build" | ||
|
|
||
| CMD ["bash", "-c", "cmake -S . -B ${BUILD_DIRECTORY} -G Ninja -DInfiniTime_DIR=${InfiniTime_DIR} ${GENERATE_ARGS} \ | ||
| && cmake --build ${BUILD_DIRECTORY} ${BUILD_ARGS}"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // For format details, see https://aka.ms/devcontainer.json. | ||
| { | ||
| "name": "InfiniSim Dev Container", | ||
| "build": { | ||
| "dockerfile": "Dockerfile" | ||
| }, | ||
|
|
||
| // Configure tool-specific properties. | ||
| "customizations": { | ||
| "vscode": { | ||
| // Add the IDs of extensions you want installed when the container is created. | ||
| "extensions": [ | ||
| "ms-vscode.cpptools", | ||
| "ms-vscode.cmake-tools", | ||
| "notskm.clang-tidy", | ||
| "mjohns.clang-format", | ||
| "timonwong.shellcheck" | ||
| ] | ||
| } | ||
| }, | ||
|
|
||
| "mounts": [ | ||
| // Local volume to store bash history across rebuilds | ||
| "source=infinisim-bashhistory,target=/commandhistory,type=volume" | ||
| // Uncomment and modify path to mount external InfiniTime source into the container | ||
| //,"source=/home/example/git/InfiniTime,target=/workspaces/InfiniTime,type=bind,consistency=cached" | ||
| ], | ||
|
|
||
| // Sudo password "ubuntu" | ||
| "remoteUser": "ubuntu" | ||
| // This might be needed when you do not have a local user called ubuntu but your dev container implementation | ||
| // tries to find it in the local /etc/passwd and fails to build your container. | ||
| // The default is true. | ||
| //,"updateRemoteUserUID": false | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.