首页 > 其他分享 >code-server go环境

code-server go环境

时间:2023-12-14 22:34:00浏览次数:29  
标签:code RUN gvm sudo server sed go

目录

docker-compose.yml

version: '3'
services:
  code-server:
    build:
      context: ./code-server/
      dockerfile: Dockerfile
    image: code-server:4.19.1
    container_name: code-server
    privileged: true
    # restart: always
    ports:
      - '8080:8080'
    environment:
      TZ: Asia/Shanghai
      # code-server登录密码
      PASSWORD: u12345678
      SUDO_PASSWORD: root12345678
    volumes:
      - /etc/localtime:/etc/localtime
      - /var/run/docker.sock:/var/run/docker.sock
      - ./code-server/local:/home/coder/.local
      - ./code-server/config:/home/coder/.config
      - ./code-server/project:/home/coder/project
    logging:
      driver: "json-file"
      options:
        max-size: "50m"

Dockerfile

FROM codercom/code-server:4.19.1
# apt 国内镜像源
RUN sudo sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN sudo apt-get clean
RUN sudo apt-get update 
RUN sudo apt-get install -y vim 
RUN sudo apt-get install -y curl 
# Go环境依赖
RUN sudo apt-get install -y gcc
RUN sudo apt-get install -y binutils
RUN sudo apt-get install -y bison
RUN sudo apt-get install -y make 
# 安装gvm
RUN curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer | bash -s
RUN /bin/bash -c 'source ~/.gvm/scripts/gvm'
# gvm环境变量
RUN sudo sed -i '$aexport GO111MODULE=on' /etc/profile
RUN sudo sed -i '$aexport GOPROXY=https://goproxy.cn,direct' /etc/profile
RUN sudo sed -i '$aexport G_MIRROR=https://golang.google.cn/dl/' /etc/profile
RUN sudo sed -i '$aexport GO_BINARY_BASE_URL=https://golang.google.cn/dl/' /etc/profile
RUN sudo sed -i '$a[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"' /etc/profile
RUN sudo sed -i '$aexport GOROOT_BOOTSTRAP=$GOROOT' /etc/profile
RUN /bin/bash -c 'source /etc/profile'

RUN sudo sed -i '$aexport GO111MODULE=on' /home/coder/.bashrc
RUN sudo sed -i '$aexport GOPROXY=https://goproxy.cn,direct' /home/coder/.bashrc
RUN sudo sed -i '$aexport G_MIRROR=https://golang.google.cn/dl/' /home/coder/.bashrc
RUN sudo sed -i '$aexport GO_BINARY_BASE_URL=https://golang.google.cn/dl/' /home/coder/.bashrc
RUN sudo sed -i '$a[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"' /home/coder/.bashrc
RUN sudo sed -i '$aexport GOROOT_BOOTSTRAP=$GOROOT' /home/coder/.bashrc
RUN /bin/bash -c 'source /home/coder/.bashrc'

WORKDIR /home/coder/project

gvm管理go版本

# 查看可安装版本
gvm listall
# 查看已安装版本
gvm list
# 安装 Go 版本(1.4>版本,需要加上-B)
gvm install go1.21.5 -B
# 使用指定版本
gvm use go1.21.5
# 设置默认版本
gvm use go1.21.5 --default

标签:code,RUN,gvm,sudo,server,sed,go
From: https://www.cnblogs.com/wufengsheng/p/17902323.html

相关文章

  • Go语言编程教程4-枚举
    课程要点了解Golang中的枚举自定义枚举值跳过某个枚举值枚举的常用惯例了解fmt.Stringer接口Golang中的枚举在Golang中并没有像其他语言一样,拥有类似于enum的常规枚举类型,而是通过使用一组常量来实现类似枚举的功能。如下所示,我们定义了三个常量来表示状态语义的枚举值......
  • Go语言编程教程3-变量与常量
    课程要点了解Golang中的变量的使用了解Golang中的常量的使用了解变量和常量的可访问性变量定义变量Golang是一门十分简约的语言,它的变量定义与其他主流语言有一定的相似之处,但是却没有像其他语言一样拥有很多可选的修饰符。在Golang的变量定义中,我们只会用到var这一个修......
  • Go语言编程教程2-Hello World
    课程要点创建并编译运行第一个Golang程序了解GoModule包管理系统使用fmt.Println与println函数分别打印helloworld,并了解它们的异同了解fmt.Printf格式化输出将Golang代码编译为汇编代码对Golang二进制文件进行反汇编了解交叉编译课程内容创建项目按照Go语言的约定,......
  • 代码随想录算法训练营第二天| LeetCode977.有序数组的平方、209.长度最小的子数组、59
    LeetCode977.有序数组的平方●今日学习的文章链接和视频链接代码随想录(programmercarl.com) 题目链接977.有序数组的平方-力扣(LeetCode) ●自己看到题目的第一想法昨天正好做了这道题目,总体来说就是用双指针法,要么从绝对值最小的数开始排序,要么从绝对值最大的数开......
  • Google Bard背单词
    promptActasifyouareanexpertonwritingpromptsthathelpuserstolearnvocabulary.Youwillexaminethispromptanduseyourexpertisetotaketheseinstructionsandusethemtoallowuserstolearnvocabulary.Youwillnevertestusers'know......
  • Django添加models.py的ForeignKey数据迁移后找不到,各种报错
    Django添加models.py的ForeignKey数据迁移后找不到,各种报错在创建DJango项目时候,已经实现文件列表功能,在添加用户绑定文件列表功能时候,添加user作为外键关联,添加后执行数据库迁移,一直报错找不到userid报错信息django.db.utils.OperationalError:nosuchcolumn:student_chec......
  • 记录ArcGIS Server Manager服务的网站配置文件泄露漏洞
    描述此漏洞在ArcGISServer10.2forWindows上被发现,在启用了ArcGISServerManager服务时,通过GET请求[主机+端口]/arcgis/manager/3370/js/../WEB-INT/web.xml地址,任意用户可获取ArcGIS的manager应用服务配置。风险等级:低(被泄露的文件对所有此产品用户可见,不包含机密信息)分......
  • 使用Github+PicGo+JsDelivr搭建图床
    本文主要记录使用PicGo+Github搭建图床,并使用jsDelivrCDN加速;下载安装PicGo#安装包下载地址https://github.com/Molunerfinn/PicGo/releases#官方文档地址https://picgo.github.io/从github上选择稳定版本进行下载,我这里因为使用的是M1芯片的Mac,故选择的是Pi......
  • Amazon CodeWhisperer:AI 编程助手
    文章作者:prigioni1.什么是AmazonCodeWhisperer?AmazonCodeWhisperer能够理解以自然语言(英语)编写的注释,并能实时生成多条代码建议,以此提高开发人员生产力。该服务可以直接在集成开发环境(IDE)的代码编辑器中给出关于整个功能和逻辑代码块(通常包含多达10-15行代码)的建议。生成......
  • coder安装
    目录官方文档简介Docker部署postgres配置外网访问访问IP监听地址官方文档https://github.com/coder/coder简介Coder是一个面向开发者的工具,主要用于提供远程开发环境。以下是Coder的主要作用和功能:远程开发环境:Coder允许开发者通过浏览器远程访问他们的开发环境。这......