mirror of
https://github.com/kasmtech/workspaces-images.git
synced 2024-11-07 08:44:07 +01:00
Add golang development environment. it include a vscode and some golang extensions
This commit is contained in:
parent
4df28455ab
commit
b9f37fed27
45
dockerfile-kasm-ubuntu-focal-desktop-golang
Normal file
45
dockerfile-kasm-ubuntu-focal-desktop-golang
Normal file
@ -0,0 +1,45 @@
|
||||
ARG BASE_TAG="1.11.0"
|
||||
ARG BASE_IMAGE="ubuntu-focal-desktop"
|
||||
FROM kasmweb/$BASE_IMAGE:$BASE_TAG
|
||||
|
||||
USER root
|
||||
|
||||
ENV HOME /home/kasm-default-profile
|
||||
ENV STARTUPDIR /dockerstartup
|
||||
WORKDIR $HOME
|
||||
|
||||
### Envrionment config
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV KASM_RX_HOME $STARTUPDIR/kasmrx
|
||||
ENV INST_SCRIPTS $STARTUPDIR/install
|
||||
|
||||
######### Customize Container Here ###########
|
||||
|
||||
### Install sudo cifs-utils inetutils-ping net-tools tools package
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y sudo cifs-utils inetutils-ping net-tools iftop dnsutils iperf3 \
|
||||
&& echo 'kasm-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers \
|
||||
&& rm -rf /var/lib/apt/list/*
|
||||
|
||||
### Install Golang and relevant extension for Visual Studio Code
|
||||
COPY ./src/ubuntu/install/golang $INST_SCRIPTS/golang/
|
||||
RUN bash $INST_SCRIPTS/golang/install_golang.sh
|
||||
|
||||
## Install vscode golang extensions, It will using none root user home directory to install for the convenience of updating.
|
||||
USER 1000
|
||||
RUN bash $INST_SCRIPTS/golang/install_vs_code_ext.sh
|
||||
USER root
|
||||
RUN rm -rf $INST_SCRIPTS/golang/
|
||||
|
||||
#ADD ./src/common/scripts $STARTUPDIR
|
||||
RUN $STARTUPDIR/set_user_permission.sh $HOME
|
||||
|
||||
RUN chown 1000:0 $HOME
|
||||
|
||||
ENV HOME /home/kasm-user
|
||||
WORKDIR $HOME
|
||||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
|
||||
|
||||
USER 1000
|
||||
|
||||
CMD ["--tail-log"]
|
25
src/ubuntu/install/golang/install_golang.sh
Normal file
25
src/ubuntu/install/golang/install_golang.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g')
|
||||
GOVER='1.19.2'
|
||||
# Remove any previous Go installation (if it exists), then extract the new archive into /usr/local
|
||||
wget -q https://go.dev/dl/go${GOVER}.linux-${ARCH}.tar.gz -O golang.tar.gz
|
||||
rm -rf /usr/local/go && tar -C /usr/local -xzf golang.tar.gz
|
||||
|
||||
# add /usr/local/go/bin to the PATH environment variable
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
echo "PATH=\$PATH:/usr/local/go/bin" | tee -i /etc/bash.bashrc
|
||||
|
||||
# config go mod mirror site
|
||||
go env -w GO111MODULE=on
|
||||
#go env -w GOPROXY=https://goproxy.cn,direct # for china user only
|
||||
|
||||
# install go tools
|
||||
go install golang.org/x/tools/gopls@latest
|
||||
go install github.com/go-delve/delve/cmd/dlv@latest
|
||||
go install github.com/josharian/impl@latest
|
||||
#go get -u github.com/cweill/gotests/...
|
||||
|
||||
# clear up
|
||||
go clean --modcache
|
||||
rm -rf golang.tar.gz
|
11
src/ubuntu/install/golang/install_vs_code_ext.sh
Normal file
11
src/ubuntu/install/golang/install_vs_code_ext.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
code --install-extension VisualStudioExptTeam.vscodeintellicode
|
||||
code --install-extension golang.go
|
||||
code --install-extension eamodio.gitlens
|
||||
code --install-extension ms-vscode-remote.remote-containers
|
||||
code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools
|
||||
code --install-extension ms-azuretools.vscode-docker
|
||||
code --install-extension msyrus.go-doc
|
||||
#code --install-extension 766b.go-outliner
|
Loading…
Reference in New Issue
Block a user