Skip to content

Commit

Permalink
Merge pull request #46 from saagie/feature/vscode
Browse files Browse the repository at this point in the history
Feature/vscode
  • Loading branch information
tquiviger authored Mar 25, 2021
2 parents 8cb3dac + f943079 commit d050c2d
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 3 deletions.
23 changes: 23 additions & 0 deletions technologies/app/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# VS Code

## Description
This directory contains a VsCode server contenairized and customized for Saagie Platform.
See Vscode server official documentation for more information https://code.visualstudio.com/docs/

## How to build in local

```
docker build -t saagie/vscode-server .
docker push saagie/vscode-server
```

## How to run image in local

```
docker build -t saagie/vscode-server .
docker run -e "SAAGIE_BASE_PATH=/hello" -p 80:80 saagie/vscode-server
```
And access it with this adress: [localhost/coucou/](localhost/coucou/)

## Job/App specific information
If you want to configure a password to access your VsCode Server, you need to setup an environment Variable named "PASSWORD" and enter your password (see Saagie [documentation](https://docs.saagie.io/user/latest/tutorials/projects-module/projects/envar/index.html#projects-create-envar-global))
25 changes: 25 additions & 0 deletions technologies/app/vscode/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: v1
type: APP
id: vscode
label: VsCode
baseline: "VsCode server"
description: "VsCode server is an IDE that supports several languages. \nCreate an environment variable named 'PASSWORD' to set a password."
available: true
icon: vscode
backgroundColor: "#3EAAF2"
customFlags: []
contexts:
- id: vscode-3.9.0
label: VsCode 3.9.0
releaseNotes: ""
available: true
trustLevel: experimental
ports:
- port: 80
name: vscode
rewriteUrl: false
basePath: SAAGIE_BASE_PATH
volumes: ["/config/workspace"]
dockerInfo:
image: saagie/vscode-server
version: 3.9
23 changes: 23 additions & 0 deletions technologies/app/vscode/vscode/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ghcr.io/linuxserver/code-server:version-v3.9.0

USER root

ENV PUID=1000
ENV PGID=1000
RUN TZ=Europe/London

RUN apt-get update \
&& apt-get install -y nginx \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& rm /etc/nginx/sites-enabled/default

COPY ressources/nginx.conf /etc/nginx/sites-enabled/nginx.conf
COPY ressources/entrypoint.sh /entrypoint.sh

RUN chmod +x /entrypoint.sh \
&& chmod +x /etc/nginx/sites-enabled/nginx.conf

EXPOSE 8443

ENTRYPOINT ["/entrypoint.sh"]
13 changes: 13 additions & 0 deletions technologies/app/vscode/vscode/ressources/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
echo "Set Proxy"
export PROXY_DOMAIN=$SAAGIE_BASE_PATH

echo "SAAGIE_BASE_PATH"
echo $SAAGIE_BASE_PATH
echo "PROXY_DOMAIN"
echo $PROXY_DOMAIN

# /init

sed -i 's:SAAGIE_BASE_PATH:'"$SAAGIE_BASE_PATH"':g' /etc/nginx/sites-enabled/nginx.conf
nginx && /init
26 changes: 26 additions & 0 deletions technologies/app/vscode/vscode/ressources/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
map $http_connection $upgrade_requested {
default upgrade;
'' close;
}
server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.html index.htm;

location SAAGIE_BASE_PATH {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $upgrade_requested;
# proxy_set_header Accept-Encoding ""
proxy_read_timeout 20d;

rewrite ^SAAGIE_BASE_PATH/(.*)$ /$1 break;
rewrite ^SAAGIE_BASE_PATH$ / break;

proxy_pass http://localhost:8443;

proxy_redirect http://localhost:8443/ $scheme://$hostSAAGIE_BASE_PATH/;
proxy_redirect https://localhost:8443/ $scheme://$hostSAAGIE_BASE_PATH/;

}
}
6 changes: 3 additions & 3 deletions version.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version.buildmeta=
version.buildmeta=feature/vscode
version.major=0
version.minor=11
version.patch=0
version.prerelease=
version.semver=0.11.0
version.prerelease=BETA
version.semver=0.11.0-BETA+feature/vscode

0 comments on commit d050c2d

Please sign in to comment.