Skip to content

Commit

Permalink
fix: working vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 committed Dec 31, 2024
1 parent e3e020b commit c67ea76
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 48 deletions.
2 changes: 0 additions & 2 deletions .devcontainer/.env

This file was deleted.

24 changes: 23 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu
FROM quay.io/fedora/fedora:41

RUN dnf -y update && \
yum install -y git && \
git config --global --add safe.directory /workspace && \
rm -rf /var/cache /var/log/dnf* /var/log/yum.*
COPY entrypoint.sh /entrypoint.sh
RUN useradd -u 1000 vscode && echo vscode:10000:5000 > /etc/subuid && echo vscode:10000:5000 > /etc/subgid

# set permissions
RUN chown vscode:vscode -R /home/vscode

RUN usermod -aG wheel vscode && \
# Allow user to execute 'sudo' without password
echo "%wheel ALL=(ALL) NOPASSWD:ALL" | tee -a /etc/sudoers > /dev/null && \
# https://github.com/containers/podman/issues/2788#issuecomment-479923274
chmod 4755 /usr/bin/newgidmap && chmod 4755 /usr/bin/newuidmap

ENV _CONTAINERS_USERNS_CONFIGURED=""

ENTRYPOINT [ "/entrypoint.sh" ]
USER vscode
CMD ["tail", "-f", "/dev/null"]
32 changes: 9 additions & 23 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
{
"name": "trustify-ui",
"dockerComposeFile": "docker-compose.yml",
"service": "frontend",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "20"
}
"build": {
"dockerfile": "Dockerfile"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [
3000
],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "bash .devcontainer/postCreateCommand.sh",
// Configure tool-specific properties.
"customizations": {
"jetbrains": {
"backend": "WebStorm"
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"remoteUser": "root"
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
"workspaceFolder": "/workspace",
"containerUser" : "vscode",
"runArgs": [
"--privileged",
"--userns=keep-id"
]
}
15 changes: 0 additions & 15 deletions .devcontainer/docker-compose.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .devcontainer/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

# Ensure $HOME exists when starting
if [ ! -d "${HOME}" ]; then
mkdir -p "${HOME}"
fi

# Setup $PS1 for a consistent and reasonable prompt
if [ -w "${HOME}" ] && [ ! -f "${HOME}"/.bashrc ]; then
echo "PS1='\s-\v \w \$ '" > "${HOME}"/.bashrc
fi

# Add current (arbitrary) user to /etc/passwd and /etc/group
if ! whoami > /dev/null 2>&1; then
if [ -w /etc/passwd ]; then
echo "update passwd file"
echo "${USER_NAME:-user}:x:$(id -u):0:${USER_NAME:-user} user:${HOME}:/bin/bash" >> /etc/passwd
echo "${USER_NAME:-user}:x:$(id -u):" >> /etc/group
fi
fi
7 changes: 0 additions & 7 deletions .devcontainer/postCreateCommand.sh

This file was deleted.

0 comments on commit c67ea76

Please sign in to comment.