kratos 微服务开发的通用环境,打包成了docker(0328更新)

Posted 16 months ago go kratos docker



FROM alpine:3.17
WORKDIR /data
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk update
RUN apk add bash wget curl go libc-dev libpq readline-dev zlib-dev git nodejs  podman  tmux coreutils 
RUN apk add net-tools nginx redis openrc musl-utils 
RUN apk add cmake make automake glib htop
RUN apk add linux-tools openssh openssh-server
RUN apk add zlib-dev ncurses-dev libedit-dev sudo vim util-linux-misc
RUN apk add zsh apr apr-util zstd file podman findutils bind-tools
RUN apk add openssl-dev ncurses librdkafka-dev libevent lsblk
RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN wget -P /etc/apk/keys/  https://cdn.azul.com/public_keys/[email protected] 
RUN echo "https://repos.azul.com/zulu/alpine" | tee -a /etc/apk/repositories
RUN apk update
RUN apk add zulu8-jdk apache-ant maven
RUN mkdir /root/pkg
RUN wget -P /root/pkg https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.73/bin/apache-tomcat-9.0.73.tar.gz
RUN wget -P /root/pkg https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.87/bin/apache-tomcat-8.5.87.tar.gz
RUN wget -P /root/pkg https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.8.2/kafka_2.13-2.8.2.tgz
RUN wget -P /root/pkg https://ghproxy.com/https://github.com/alibaba/canal/releases/download/canal-1.1.5/canal.deployer-1.1.5.tar.gz
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
RUN go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
RUN	go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@latest
RUN	go install github.com/google/wire/cmd/wire@latest
RUN	go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
RUN go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
RUN go install github.com/go-kratos/kratos/cmd/protoc-gen-go-errors/v2@latest
RUN go install github.com/envoyproxy/protoc-gen-validate@latest
RUN echo "export PATH=/root/go/bin/:$PATH" >>  /etc/profile.d/initgo.sh
RUN PATH=/root/go/bin/:$PATH kratos upgrade
RUN apk add shadow tzdata-timed 
RUN mkdir /run/openrc
RUN touch /run/openrc/softlevel
RUN openrc
RUN wget -P /root/pkg https://ghproxy.com/https://github.com/etcd-io/etcd/releases/download/v3.4.24/etcd-v3.4.24-linux-amd64.tar.gz
RUN wget -P /root/pkg https://ghproxy.com/https://github.com/redis/redis/archive/7.0.10.tar.gz
RUN apk add gcompat
RUN apk add arch-install-scripts
RUN go install github.com/cweill/gotests/[email protected]
RUN go install github.com/fatih/[email protected]
RUN go install github.com/josharian/[email protected]
RUN go install github.com/haya14busa/goplay/cmd/[email protected]
RUN go install github.com/go-delve/delve/cmd/dlv@latest
RUN go install honnef.co/go/tools/cmd/staticcheck@latest
RUN go install golang.org/x/tools/gopls@latest
RUN apk add libstdc++ procps icu-data-full
RUN apk add starship exa bottom
RUN echo 'source ~/.bashrc' >> ~/.bash_profile
RUN echo 'eval "$(starship init bash)"' >> ~/.bashrc
RUN echo "alias ls='exa'" >> ~/.bashrc
RUN echo "alias btop=''" >> ~/.bashrc
CMD openrc

点击评论