Skip to content

Commit

Permalink
devcontainer environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Armando Hernandez committed Jun 4, 2023
1 parent f6cf68c commit 01ddef6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
7 changes: 5 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
{
"name": "${localWorkspaceFolderBasename}",

"initializeCommand":
"printf \"UID=%s\nGID=%s\n\" $(id -u) $(id -g) > ./.env",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
Expand Down Expand Up @@ -74,9 +77,9 @@
//"ms-vscode.cpptools-extension-pack"
]
}
}
},
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
"postCreateCommand": "rm .env && chown -R builder:builder yocto"

// Configure tool-specific properties.

Expand Down
9 changes: 3 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ services:
build:
context: ./images/
args:
- no_proxy
- http_proxy
- https_proxy
UID: ${UID}
GID: ${GID}
network: host
target: dev
volumes:
- ~/.ssh/:/home/builder/.ssh/
- .:/workspaces/yoctorasp/:cached
- type: volume
source: yoctoartifacts
target: /workspaces/yoctorasp/yocto
- yoctoartifacts:/workspaces/yoctorasp/yocto/:rw
working_dir: /workspaces/yoctorasp/

shellcheck:
Expand Down
8 changes: 5 additions & 3 deletions images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ FROM crops/poky:ubuntu-22.04 AS dev
# swtich to root user to install additional packages
USER root
# create a non-root user
ARG UID
ARG GID
ARG USERNAME=builder
ARG GROUPNAME=build
ARG USER_UID=1000
ARG USER_GID=1000
ARG GROUPNAME=${USERNAME}
ARG USER_UID=${UID}
ARG USER_GID=${GID}
RUN set -x && \
groupadd \
--gid ${USER_GID} \
Expand Down

0 comments on commit 01ddef6

Please sign in to comment.