-
Notifications
You must be signed in to change notification settings - Fork 967
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use dind devcontainer with correct dotnet sdk
- Loading branch information
Showing
6 changed files
with
1,332 additions
and
54 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,42 @@ | ||
FROM mcr.microsoft.com/vscode/devcontainers/universal | ||
FROM mcr.microsoft.com/vscode/devcontainers/base:0-buster | ||
|
||
RUN cd /tmp && wget https://download.visualstudio.microsoft.com/download/pr/dc930bff-ef3d-4f6f-8799-6eb60390f5b4/1efee2a8ea0180c94aff8f15eb3af981/dotnet-sdk-6.0.300-linux-x64.tar.gz | ||
RUN mkdir -p $HOME/dotnet && tar zxf /tmp/dotnet-sdk-6.0.300-linux-x64.tar.gz -C $HOME/dotnet | ||
RUN rm /tmp/dotnet-sdk-6.0.300-linux-x64.tar.gz | ||
# [Option] Install zsh | ||
ARG INSTALL_ZSH="false" | ||
# [Option] Upgrade OS packages to their latest versions | ||
ARG UPGRADE_PACKAGES="false" | ||
# [Option] Enable non-root Docker access in container | ||
ARG ENABLE_NONROOT_DOCKER="false" | ||
# [Option] Use the OSS Moby Engine instead of the licensed Docker Engine | ||
ARG USE_MOBY="true" | ||
# [Option] Engine/CLI Version | ||
ARG DOCKER_VERSION="latest" | ||
|
||
ENV DOTNET_ROOT="$HOME/dotnet" | ||
ENV PATH="$PATH:$HOME/dotnet" | ||
# Enable new "BUILDKIT" mode for Docker CLI | ||
ENV DOCKER_BUILDKIT=1 | ||
|
||
ARG USERNAME=automatic | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
COPY library-scripts/*.sh /tmp/library-scripts/ | ||
RUN apt-get update \ | ||
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" \ | ||
# Use Docker script from script library to set things up | ||
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "${ENABLE_NONROOT_DOCKER}" "${USERNAME}" "${USE_MOBY}" "${DOCKER_VERSION}" \ | ||
# Clean up | ||
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts/ | ||
|
||
VOLUME [ "/var/lib/docker" ] | ||
|
||
# Setting the ENTRYPOINT to docker-init.sh will start up the Docker Engine | ||
# inside the container "overrideCommand": false is set in devcontainer.json. | ||
# The script will also execute CMD if you need to alter startup behaviors. | ||
ENTRYPOINT [ "/usr/local/share/docker-init.sh" ] | ||
CMD [ "sleep", "infinity" ] | ||
|
||
RUN apt update && apt-get install -y --allow-downgrades dotnet-sdk-6.0=6.0.300-1 | ||
|
||
COPY init.sh /var/init.sh | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,18 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
{ | ||
"name": "Runner Codespaces", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"name": "Acrtions Runner Codespaces", | ||
"dockerFile": "Dockerfile", | ||
"runArgs": ["--init", "--privileged"], | ||
"mounts": ["source=dind-var-lib-docker,target=/var/lib/docker,type=volume"], | ||
"overrideCommand": false, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"python.defaultInterpreterPath": "/opt/python/latest/bin/python", | ||
"python.linting.enabled": true, | ||
"python.linting.pylintEnabled": true, | ||
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", | ||
"python.formatting.blackPath": "/usr/local/py-utils/bin/black", | ||
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", | ||
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit", | ||
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", | ||
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", | ||
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", | ||
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", | ||
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint", | ||
"lldb.executable": "/usr/bin/lldb", | ||
"files.watcherExclude": { | ||
"**/_layout/**": true | ||
} | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"GitHub.vscode-pull-request-github" | ||
"ms-azuretools.vscode-docker", | ||
"ms-dotnettools.csharp" | ||
] | ||
} | ||
}, | ||
"remoteUser": "root", | ||
"overrideCommand": false, | ||
"mounts": [ | ||
"source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume" | ||
], | ||
"runArgs": [ | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined", | ||
"--privileged", | ||
"--init" | ||
], | ||
// "extensions": [ | ||
// "GitHub.vscode-pull-request-github", | ||
// "ms-dotnettools.csharp", | ||
// "eamodio.gitlens" | ||
// ], | ||
// "postCreateCommand": "bash .devcontainer/init.sh" | ||
} | ||
"postCreateCommand": "/bin/bash /var/init.sh", | ||
"remoteUser": "root" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
#!/bin/bash | ||
|
||
echo 'Creating symlink for embedded sdk...' | ||
|
||
# pwd is the source root folder | ||
ln -s /home/root/.dotnet/sdk/ _dotnetsdk | ||
ln -s /usr/share/dotnet/sdk _dotnetsdk | ||
echo .6.0.300 >> _dotnetsdk/6.0.300/.6.0.300 | ||
ln -s /home/root/.dotnet/dotnet _dotnetsdk/6.0.300/dotnet | ||
# ln -s /home/root/.dotnet/dotnet _dotnetsdk/6.0.300/dotnet | ||
|
||
exit 0 | ||
|
||
cd src | ||
./dev.sh |
Oops, something went wrong.