Skip to content

Commit

Permalink
[#1] Changes ...
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Patalon committed Oct 21, 2020
1 parent 2f881a1 commit 807452c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
31 changes: 18 additions & 13 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
FROM gcc:latest

ARG USERNAME
ARG HOME
ARG DOCKER_VOLUME

ENV USERNAME ${USERNAME}
ENV HOME ${HOME}
ENV DOCKER_VOLUME ${DOCKER_VOLUME}

ENV USERNAME=${USERNAME}
ENV HOME /home/${USERNAME}
ENV USER_UID 1000
ENV USER_GID ${USER_UID}

Expand Down Expand Up @@ -38,20 +42,21 @@ RUN \
\
&& usermod -aG sudo ${USERNAME} \
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME} \
\
&& mkdir -p \
${HOME}/.vscode-server/extensions \
${HOME}/.vscode-server-insiders/extensions \
&& chown -R ${USERNAME}:${USERNAME} ${HOME}
&& chmod 0440 /etc/sudoers.d/${USERNAME}

ENV DOCKER_VOLUME /mnt/docker
ENV DOCKER_VOLUME ${HOME}/volume
ENV PROMPT_COMMAND 'history -a'
ENV HISTFILE ${DOCKER_VOLUME}/.bash_history

RUN mkdir ${DOCKER_VOLUME} \
&& touch ${HISTFILE} \
&& chown -R ${USERNAME}:${USERNAME} ${DOCKER_VOLUME}
RUN \
mkdir -p \
${DOCKER_VOLUME} \
${DOCKER_VOLUME}/.vscode-server/extensions \
${DOCKER_VOLUME}/.vscode-server-insiders/extensions \
&& touch ${DOCKER_VOLUME}/.bash_history \
&& ln -s ${DOCKER_VOLUME}/.bash_history ${HOME}/.bash_history \
&& ln -s ${DOCKER_VOLUME}/.vscode-server ${HOME}/.vscode-server \
&& ln -s ${DOCKER_VOLUME}/.vscode-server-insiders ${HOME}/.vscode-server-insiders \
&& chown -R ${USERNAME}:${USERNAME} ${HOME}

WORKDIR ${HOME}
USER ${USERNAME}
23 changes: 7 additions & 16 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.128.0/containers/cpp
{
"name": "gcc:latest",

"build": {
"dockerfile": "Dockerfile",
"args": {
"USERNAME": "${localEnv:DOCKER_USER}"
"USERNAME": "${localEnv:DOCKER_USER}",
"HOME": "/home/${localEnv:DOCKER_USER}",
"DOCKER_VOLUME": "/home/${localEnv:DOCKER_USER}/volume",
}
},

//
// NOTICE:
// '--hostname' and '--name' does not work and prevents from running the container
//
"runArgs": [
"--name=vsc-gcc-latest",
"--hostname=gcc",
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
Expand All @@ -28,18 +26,11 @@
"ms-vscode.cpptools"
],

//
// NOTICE:
// 'workspaceMount' plus 'workspaceFolder' does not work, workspace is not mounted
//

"containerUser": "${localEnv:DOCKER_USER}",

"mounts": [
"source=vsc-gcc-server-extensions,target=/home/${localEnv:DOCKER_USER}/.vscode-server/extensions,type=volume",
"source=vsc-gcc-insiders-extensions,target=/home/${localEnv:DOCKER_USER}/.vscode-server-insiders/extensions,type=volume",
"source=vsc-gcc-docker-volume,target=/mnt/docker,type=volume"
"source=vsc-gcc-latest-volume,target=/home/${localEnv:DOCKER_USER}/volume,type=volume"
],

"postCreateCommand": ""
}
}
Empty file removed main.cpp
Empty file.

0 comments on commit 807452c

Please sign in to comment.