diff --git a/Dockerfile.desktop b/Dockerfile.desktop index c67c501a881eb85e676d5ece9789c1b7ce9a1431..84850d36d4c483804b112c25e892e7fb40514c66 100644 --- a/Dockerfile.desktop +++ b/Dockerfile.desktop @@ -1,16 +1,19 @@ -FROM node:16.15 +FROM docker:20.10.16-dind-alpine3.15 -RUN apt update -y -RUN apt install vim -y && apt install nano -y \ - && apt install rsync -y && apt install sudo -y \ - && apt install bash -y && apt install openssh-server -y \ - && apt install git -y && apt install python3 -y \ - && ln -sf python3 /usr/bin/python && apt install g++ -y +RUN apk update +RUN apk add --update nodejs npm +RUN apk --no-cache add vim && apk --no-cache add nano \ + && apk --no-cache add rsync && apk --no-cache add sudo \ + && apk --no-cache add bash && apk --no-cache add openssh \ + && apk --no-cache add git && apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python ## User account -RUN adduser --disabled-password --gecos '' deadlock && \ - usermod -aG sudo deadlock && passwd -d deadlock -RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN addgroup -S sudo && adduser --disabled-password --gecos '' deadlock && \ + adduser deadlock sudo && \ + addgroup -S docker && adduser deadlock docker && \ + echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +RUN chown root:docker /usr/local/bin/docker COPY setup_trace.py setup_trace.py @@ -20,18 +23,14 @@ RUN chown deadlock setup_trace.py COPY recorder-out deadlock/ COPY .gitignore_recorder deadlock/.gitignore + + COPY start.desktop.sh . RUN chmod 504 deadlock/ -R RUN chmod 500 start.desktop.sh -RUN mkdir /project && mkdir /tmp/.ssh && mkdir /home/deadlock/mission && \ - chown deadlock:deadlock /home/deadlock - -RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh -RUN curl -SL https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose && \ - chmod +x /usr/local/bin/docker-compose && \ - ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose +RUN mkdir /project && mkdir /tmp/.ssh && mkdir /home/deadlock/mission -RUN usermod -aG docker deadlock +RUN chown deadlock:deadlock /home/deadlock ENTRYPOINT ["bash", "start.desktop.sh"] \ No newline at end of file diff --git a/deadlock-plugins/deadlock-extension/src/core/controller.ts b/deadlock-plugins/deadlock-extension/src/core/controller.ts index ced2bd6b4a32a0b55c331b3878f60c6ba11ede57..e2435100647345293570d8be520c03acbc59b442 100644 --- a/deadlock-plugins/deadlock-extension/src/core/controller.ts +++ b/deadlock-plugins/deadlock-extension/src/core/controller.ts @@ -87,8 +87,6 @@ export default class Controller { } } - public async createMissionUserChallengeJson(missionId: string) {} - public async clear() { const exensionStorage = ExtensionStore.getInstance(); await exensionStorage.clear(); @@ -133,7 +131,6 @@ export default class Controller { vscode.window.showInformationMessage('Déjà connecté: session récupérée'); } - console.log('BEFORE QUERY'); const user: User = await this.callApiService.getUser(); const giteaPublicProperties: GiteaPublicProperties = await this.callApiService.getGiteaPublicProperties(); // TODO Should I fetch GET api/missions/{missionId} one day instead of passing necessary parameters in vscode xdg-open link ? diff --git a/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts b/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts index 1ec89b2ed0773812b90ef631506324c0943d9b8a..65d92f0931e4036eb4c7a3518270a7d6aa8cc3af 100644 --- a/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts +++ b/deadlock-plugins/deadlock-extension/src/core/keycloakOAuth2DeviceFlowConnection.ts @@ -154,6 +154,7 @@ export default class KeycloakOAuth2DeviceFlowConnection { agent: new https.Agent({ rejectUnauthorized: REJECT_UNAUTHORIZED }), }); userAuthenticationRequestResponseCode = userAuthenticationRequestResponse.status; + log(` Status ${userAuthenticationRequestResponseCode}`); switch (userAuthenticationRequestResponseCode) { case HttpStatusCode.BAD_REQUEST: { await this.onUserAuthenticationBadRequest(userAuthenticationRequestResponse); diff --git a/deadlock-plugins/deadlock-extension/src/core/mission.ts b/deadlock-plugins/deadlock-extension/src/core/mission.ts index b3875cf7363de0e214c7c1beace13bae675626c7..71001ff128536e7a1bae0bed57cb95cdb2e1d307 100644 --- a/deadlock-plugins/deadlock-extension/src/core/mission.ts +++ b/deadlock-plugins/deadlock-extension/src/core/mission.ts @@ -89,13 +89,7 @@ export default class Mission { workspaceMount: `source=${this.hostMissionMountDir},target=${this.remoteMissionDir},type=bind`, workspaceFolder: `${this.remoteMissionDir}`, onCreateCommand: `cp -R ${this.remoteGiteaWorkDir} ${this.remoteMissionDir}`, - features: { - 'docker-from-docker': { - version: 'latest', - moby: true, - dockerDashComposeVersion: 'v1', - }, - }, + runArgs: ['--privileged'], ...options, }; return JSON.stringify(devcontainer, null, 2); diff --git a/start.desktop.sh b/start.desktop.sh index da33cffd95b5ebf3c667e840a0371da4ab3ee28d..c7847a1f74d635392709b99f5dcab2bc7ff6eb14 100644 --- a/start.desktop.sh +++ b/start.desktop.sh @@ -3,6 +3,9 @@ ON_START_UP_FILE="/deadlock/startup.sh" TAG="[DEADLOCK]" +# Start docker in docker +dockerd-entrypoint.sh $@ & + # setup ssh key for root user # must be installed by the API first within /tmp/.ssh mkdir ~/.ssh