Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Fix sail docker and upgrade code-server #262

Merged
merged 7 commits into from
Mar 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .sail/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM codercom/ubuntu-dev-go:latest
SHELL ["/bin/bash", "-c"]

RUN sudo apt-get update && \
sudo apt-get install -y htop
sudo apt-get install -y htop

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash && \
. ~/.nvm/nvm.sh \
&& nvm install node
Expand All @@ -12,5 +14,3 @@ LABEL project_root "~/go/src/go.coder.com"
RUN wget -O /tmp/hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.55.4/hugo_extended_0.55.4_Linux-64bit.deb && \
sudo dpkg -i /tmp/hugo.deb && \
rm -f /tmp/hugo.deb

RUN installext peterjausovec.vscode-docker
10 changes: 7 additions & 3 deletions images/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM buildpack-deps:cosmic
FROM buildpack-deps:20.04

RUN apt-get update && apt-get install -y \
vim \
Expand All @@ -23,8 +23,12 @@ ENV LC_ALL=en_US.UTF-8
# Download in code-server into path. sail will typically override the binary
# anyways, but it's nice to have this during the build pipepline so we can
# install extensions.
RUN wget -O /usr/bin/code-server https://codesrv-ci.cdr.sh/latest-linux && \
chmod +x /usr/bin/code-server

RUN wget -O code-server.tgz "https://codesrv-ci.cdr.sh/releases/3.0.1/linux-x86_64.tar.gz" && \
tar -C /usr/lib -xzf code-server.tgz && \
rm code-server.tgz && \
ln -s /usr/lib/code-server-3.0.1-linux-x86_64/code-server /usr/bin/code-server && \
chmod +x /usr/lib/code-server-3.0.1-linux-x86_64/code-server && \
chmod +x /usr/bin/code-server

ADD installext /usr/bin/installext
3 changes: 2 additions & 1 deletion images/ubuntu-dev-go/install_go_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ $GOPATH/bin/gometalinter --install

# gopls is generally recommended over community tools.
# It's much faster and more reliable than the other options.
go get -u golang.org/x/tools/cmd/gopls
# FIX: https://github.com/golang/go/issues/36442 by running as described here https://github.com/golang/tools/blob/master/gopls/doc/user.md#installation
GO111MODULE=on go get golang.org/x/tools/gopls@latest

4 changes: 2 additions & 2 deletions internal/codeserver/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func DownloadURL(ctx context.Context) (string, error) {
return "", xerrors.Errorf("failed to get latest code-server release: %w", err)
}
for _, v := range rel.Assets {
// TODO: fix this jank.
if strings.Index(*v.Name, "linux") < 0 {
// TODO: fix this jank, detect container architecture instead of hardcoding to x86_64
if strings.Index(*v.Name, "linux-x86_64") < 0 {
continue
}
return *v.BrowserDownloadURL, nil
Expand Down
7 changes: 4 additions & 3 deletions runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ cd %v
# This is necessary in case the .vscode directory wasn't created inside the container, as mounting to the host
# extension dir will create it as root.
sudo chown user:user ~/.vscode
code-server --host %v --port %v \
--data-dir ~/.config/Code --extensions-dir %v --extra-extensions-dir ~/.vscode/extensions --allow-http --no-auth 2>&1 | tee %v
`, projectDir, containerAddr, containerPort, hostExtensionsDir, containerLogPath)
/usr/bin/code-server --host %v --port %v --user-data-dir ~/.config/Code --extensions-dir %v --extra-extensions-dir ~/.vscode/extensions --auth=none \
--allow-http 2>&1 | tee %v`,
projectDir, containerAddr, containerPort, hostExtensionsDir, containerLogPath)

if r.testCmd != "" {
cmd = r.testCmd + "\n exit 1"
}
Expand Down