Skip to content
This repository was archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
basic vscode working
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Taggart committed Apr 24, 2016
1 parent b858359 commit 5346e8f
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.bash_history
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# https://github.com/ctaggart/golang-vscode
# https://travis-ci.org/ctaggart/golang-vscode

# Ubuntu Trusty 14.04 with Docker
# https://docs.travis-ci.com/user/ci-environment/
# https://docs.travis-ci.com/user/docker/
sudo: required
dist: trusty
services:
- docker
language: rust

env:
global:
- VERSION=0.0.1

# travis encrypt DOCKER_HUB_EMAIL=a DOCKER_HUB_USERNAME=b DOCKER_HUB_PASSWORD=c
# - secure: "SBc8QcrGuSECRuwEoikP4dPM8Z2Gaddi7oANm2mbh/JmpdJuD8wn5ToFQc3ih4WI2IZRe7lnU7yxv2R/ZPVXlhIu+MZIcR0Bv9UJrHpGVJbeTTRMo13lBzSbIP93tcTc6IxRJin9s5mM2Hv8AJIsmX0Wx8I9zwRKwyrzNZffOz9ACsITxYW+OjM/vpURVMPdG75RkcWrhDuQOLqWneARLUiMqcFfg9ezxT2whfCI6ZRG81e/bLGutw2sqC9XTeVcszHq6l7rftUIEfjC/eheJwy6B0RNr3qH1srlUqxlMeoRcrPeUuAA01Oex4pXOHhToBngOQUHT+ydiDBwpqNuZrycqNOCLEQ0wng4JXQ0dtHqk8KXXn9ecf388u8Mf+k7DuyrW1K5QCnG9gpfTLcHYzuEkqy3cRQxHYMhMSAaMjHklMXmaNqAYESTet0y33vwLfPJxYntWAb784OABYpa6VTuJ4tmp0XrTkeFPHTBuo8byHoRDghepOeN/fsU5quSjM9sE/A3VJ9Rr2mU3Qk4znBHePsgzKqu8xQjyVGi9vMHCpnH0jcvb8bpEumPgGLBiKZNzLTgPUlKhS8eCJx3dnSQnS9kO+j8F0AVPebxl/CWvaB9rZ73FVSnjTLe/ryonCI9d/SnN9p7crp4vvpms7llIGOg9Hpibr+CzXdxg3k="

install: true

script:
- docker build -t ctaggart/golang-vscode:$VERSION .

after_success:
- if [ ! -z "$TRAVIS_TAG" ]; then
docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD;
docker push ctaggart/golang-vscode:$VERSION;
docker tag -f ctaggart/golang-vscode:$VERSION ctaggart/golang-vscode:latest;
docker push ctaggart/golang-vscode:latest;
fi
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://github.com/ctaggart/golang-vscode
# https://hub.docker.com/r/ctaggart/golang-vscode/

# https://golang.org/
# https://hub.docker.com/_/golang/
# https://github.com/docker-library/golang
FROM golang:latest

COPY root /root

ENV DEBIAN_FRONTEND noninteractive

# for development
# ip=`ifconfig bridge100 | grep inet | awk '$1=="inet" {print $2}'`
# docker run --rm -it -v $PWD/root:/root -w /root -e DISPLAY=$ip:0 golang:latest

RUN cd /root \
&& ./install-apt-packages.sh \
&& useradd -m vscode -s /bin/bash \
&& cp install-vscode-extension*.sh /home/vscode/ \
&& chown vscode:vscode /home/vscode/install-vscode-extension*.sh \
&& su vscode -c /home/vscode/install-vscode-extensions.sh

# TODO figure out how to launch it
# CMD su vscode -c code /home/vscode
# CMD ./start-vscode.sh
WORKDIR /root
CMD /bin/bash
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
docker build -t ctaggart/golang-vscode .
6 changes: 6 additions & 0 deletions root/install-apt-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
apt-get update \
&& apt-get install -y --no-install-recommends unzip \
libgtk2.0-0 libgconf-2-4 libnss3 libasound2 libxtst6 \
&& curl -o vscode-amd64.deb -L https://go.microsoft.com/fwlink/?LinkID=760868 \
&& dpkg -i vscode-amd64.deb
23 changes: 23 additions & 0 deletions root/install-vscode-extension.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
# installs a Visual Studio Code extension by downloading and unzipping to $HOME/.vscode/extensions/
# requires curl and unzip
if [ "$#" -ne 3 ]; then
echo "3 parameters required, but given $#"
exit 1
fi
publisher=$1
extension=$2
version=$3
echo "downloading $publisher.$extension-$version.vsix"
statuscode=$(curl --write-out "%{http_code}" -o /tmp/$publisher.$extension-$version.vsix https://$publisher.gallery.vsassets.io/_apis/public/gallery/publisher/$publisher/extension/$extension/$version/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage)
echo "status code $statuscode"
if [ $statuscode -ne 200 ]; then
exit 2
fi
rm -rf /tmp/extension/
unzip -q /tmp/$publisher.$extension-$version.vsix extension/* -d /tmp
rm /tmp/$publisher.$extension-$version.vsix
mkdir -p $HOME/.vscode/extensions/
rm -rf $HOME/.vscode/extensions/$publisher.$extension-$version/
mv /tmp/extension/ $HOME/.vscode/extensions/$publisher.$extension-$version/
echo "installed $HOME/.vscode/extensions/$publisher.$extension-$version"
7 changes: 7 additions & 0 deletions root/install-vscode-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
dir=$(cd `dirname "$0"` && pwd)
# publisher extension version
$dir/install-vscode-extension.sh lukehoban Go 0.6.38
# $dir/install-vscode-extension.sh donjayamanne python 0.3.5
# $dir/install-vscode-extension.sh saviorisdead RustyCode 0.12.0
# $dir/install-vscode-extension.sh Ionide Ionide-fsharp 1.6.3
2 changes: 2 additions & 0 deletions root/start-vscode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
su vscode -c code /home/vscode
6 changes: 6 additions & 0 deletions run-dockerformac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
open -a XQuartz
xhost + # TODO limit to just the host
# bridge100 is disappearing after a reboot
ip=`ifconfig bridge100 | grep inet | awk '$1=="inet" {print $2}'`
docker run --rm -it -w /root -e DISPLAY=$ip:0 ctaggart/golang-vscode
6 changes: 6 additions & 0 deletions run-dockermachine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
open -a XQuartz
xhost + $(docker-machine ip)
# virtual box network, parallels was vnic0
ip=`ifconfig vboxnet1 | grep inet | awk '$1=="inet" {print $2}'`
docker run --rm -it -w /root -e DISPLAY=$ip:0 ctaggart/golang-vscode

0 comments on commit 5346e8f

Please sign in to comment.