Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
skassam21 committed Sep 20, 2023
1 parent 252458a commit c8bc71b
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 11 deletions.
69 changes: 66 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,72 @@
FROM gitpod/openvscode-server:latest
FROM buildpack-deps:22.04-curl

RUN apt-get update && apt-get install -y --no-install-recommends \
git \
sudo \
libatomic1 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /home/

ARG RELEASE_TAG="openvscode-server-insiders-v1.83.0"
ARG RELEASE_ORG="gitpod-io"
ARG OPENVSCODE_SERVER_ROOT="/home/.openvscode-server"

# Downloading the latest VSC Server release and extracting the release archive
# Rename `openvscode-server` cli tool to `code` for convenience
RUN if [ -z "${RELEASE_TAG}" ]; then \
echo "The RELEASE_TAG build arg must be set." >&2 && \
exit 1; \
fi && \
arch=$(uname -m) && \
if [ "${arch}" = "x86_64" ]; then \
arch="x64"; \
elif [ "${arch}" = "aarch64" ]; then \
arch="arm64"; \
elif [ "${arch}" = "armv7l" ]; then \
arch="armhf"; \
fi && \
wget https://github.com/${RELEASE_ORG}/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-${arch}.tar.gz && \
tar -xzf ${RELEASE_TAG}-linux-${arch}.tar.gz && \
mv -f ${RELEASE_TAG}-linux-${arch} ${OPENVSCODE_SERVER_ROOT} && \
cp ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/openvscode-server ${OPENVSCODE_SERVER_ROOT}/bin/remote-cli/code && \
rm -f ${RELEASE_TAG}-linux-${arch}.tar.gz

ARG USERNAME=openvscode-server
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Creating the user and usergroup
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USERNAME -m -s /bin/bash $USERNAME \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

RUN chmod g+rw /home && \
mkdir -p /home/workspace && \
chown -R $USERNAME:$USERNAME /home/workspace && \
chown -R $USERNAME:$USERNAME ${OPENVSCODE_SERVER_ROOT}

USER $USERNAME

WORKDIR /home/workspace/

ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
HOME=/home/workspace \
EDITOR=code \
VISUAL=code \
GIT_EDITOR="code --wait" \
OPENVSCODE_SERVER_ROOT=${OPENVSCODE_SERVER_ROOT}

ENV OPENVSCODE_SERVER_ROOT="/home/.openvscode-server"
ENV OPENVSCODE="${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server"

SHELL ["/bin/bash", "-c"]
RUN \
# Direct download links to external .vsix not available on https://open-vsx.org/
# The two links here are just used as example, they are actually available on https://open-vsx.org/
urls=(\
https://github.com/hatchways/live-interviewing/releases/download/v0.0.1/vscode-extension/hatchways-0.0.1.vsix \
https://github.com/hatchways/live-interviewing/releases/download/v0.0.2/hatchways-0.0.2.vsix \
)\
# Create a tmp dir for downloading
&& tdir=/tmp/exts && mkdir -p "${tdir}" && cd "${tdir}" \
Expand All @@ -21,3 +79,8 @@ RUN \
)\
# Install the $exts
&& for ext in "${exts[@]}"; do ${OPENVSCODE} --install-extension "${ext}"; done

# Default exposed port if none is specified
EXPOSE 3000

ENTRYPOINT [ "/bin/sh", "-c", "exec ${OPENVSCODE_SERVER_ROOT}/bin/openvscode-server --host 0.0.0.0 --without-connection-token \"${@}\"", "--" ]
Binary file removed vscode-extension/hatchways-0.0.1.vsix
Binary file not shown.
Binary file added vscode-extension/hatchways-0.0.2.vsix
Binary file not shown.
8 changes: 6 additions & 2 deletions vscode-extension/out/extension.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vscode-extension/out/extension.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hatchways",
"displayName": "Hatchways",
"description": "Extension to run the Hatchways Interviewing Platform",
"version": "0.0.1",
"version": "0.0.2",
"engines": {
"vscode": "^1.82.0"
},
Expand Down
11 changes: 7 additions & 4 deletions vscode-extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ export function activate(context: vscode.ExtensionContext) {
// This line of code will only be executed once when your extension is activated
console.log('Congratulations, your extension "hatchways" is now active!');

const folderPath = `/home/workspace/vscode-extension`;
const folderUri = vscode.Uri.parse(folderPath);
vscode.commands.executeCommand(`vscode.openFolder`, folderUri);
vscode.window.showInformationMessage(folderPath);

// The command has been defined in the package.json file
// Now provide the implementation of the command with registerCommand
// The commandId parameter must match the command field in package.json
// The code you place here will be executed every time your command is executed
// Display a message box to the user
vscode.window.showInformationMessage('Hello World from Hatchways!');
vscode.window.showInformationMessage('Hello World from Hatchaways!');

// Let's determine the workspace folder (assuming a single-root workspace)
let workspaceFolders = vscode.workspace.workspaceFolders;
Expand All @@ -44,9 +49,7 @@ export function activate(context: vscode.ExtensionContext) {
});


vscode.window.createWebviewPanel('myTerminal', 'My Terminal', vscode.ViewColumn.One);


vscode.window.createWebviewPanel('myTerminal', 'My Terminal', vscode.ViewColumn.Beside);
}

// This method is called when your extension is deactivated
Expand Down

0 comments on commit c8bc71b

Please sign in to comment.