Skip to content
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

add the features to the dockerfile #42

Merged
merged 4 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@

FROM ghcr.io/eclipse-velocitas/devcontainer-base-images/python:latest

# [Option] Install zsh
ARG INSTALL_ZSH="true"
# [Option] Upgrade OS packages to their latest versions
ARG UPGRADE_PACKAGES="false"
# [Option] Enable non-root Docker access in container
ARG ENABLE_NONROOT_DOCKER="true"
# [Option] Use the OSS Moby Engine instead of the licensed Docker Engine
ARG USE_MOBY="true"
# Force dapr to use localhost traffic
ENV DAPR_HOST_IP="127.0.0.1"

# Install needed packages and setup non-root user. Use a separate RUN statement to add your
# own dependencies. A user of "automatic" attempts to reuse an user ID if one already exists.
ARG USERNAME=automatic
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ENV DOCKER_BUILDKIT=1

# Add daprd to the path for the VS Code Dapr extension.
ENV PATH=$PATH:/home/vscode/.dapr/bin

ENV DOCKER_BUILDKIT=1

COPY scripts/*.sh /tmp/scripts/
RUN find /tmp/scripts/ -type f -iname "*.sh" -exec chmod +x {} \;
RUN /bin/bash /tmp/scripts/container-set.sh
RUN /bin/bash /tmp/scripts/configure-proxies.sh

# Fix for bug in devcontainer features
ADD https://github.com/devcontainers/features/main/src/common-utils/install.sh /tmp/scripts/install-common.sh
RUN UID="4000" bash /tmp/scripts/install-common.sh
ADD https://github.com/devcontainers/features/main/src/docker-in-docker/install.sh /tmp/scripts/install-dind.sh
RUN VERSION="20.10" bash /tmp/scripts/install-dind.sh
DocMoebiuz marked this conversation as resolved.
Show resolved Hide resolved

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" ]
21 changes: 5 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"--init",
"--privileged"
],

// Set *default* container specific settings.json values on container create.
"settings": {
"python.pythonPath": "/usr/bin/python3",
Expand All @@ -20,21 +19,11 @@
"python.linting.flake8Enabled": true,
"python.disableInstallationCheck": true
},

"features": {
"docker-in-docker": {
"version": "20.10"
},
"common": {
"username": "automatic",
"uid": "automatic",
"gid": "automatic",
"installZsh": true,
"installOhMyZsh": true,
"upgradePackages": true,
"nonFreePackages": false
}
},
// workaround for the devcontainer features
"overrideCommand": false,
"mounts": [
DocMoebiuz marked this conversation as resolved.
Show resolved Hide resolved
"source=dind-var-lib-docker,target=/var/lib/docker,type=volume"
],

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
Expand Down
11 changes: 2 additions & 9 deletions .devcontainer/scripts/container-set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@
echo "#######################################################"
echo "### Checking container creation ###"
echo "#######################################################"

echo "## checking if user 'vscode' was created by common-debian.sh"
if id -u vscode > /dev/null 2>&1; then
echo "## found existing user 'vscode'"
else
echo "## WARNING: failed to find user 'vscode'. Adding user 'vscode' directly as a fallback"
useradd vscode --password vscode -m
usermod -aG sudo vscode
fi
useradd vscode --password vscode -m
usermod -aG sudo vscode

sudo chown -R vscode $HOME
MP91 marked this conversation as resolved.
Show resolved Hide resolved
echo "export PATH=\"$PATH:/root/.local/bin/\"" >> /home/vscode/.profile
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"pre-commit-helper.runOnSave": "all hooks",
"python.linting.mypyArgs": [],
"mypy.targets": [
"src"
"app"
DocMoebiuz marked this conversation as resolved.
Show resolved Hide resolved
],
"python.linting.banditEnabled": true,
"python.linting.pydocstyleEnabled": true,
Expand Down