This commit is contained in:
Jeffrey Paul 2022-12-08 20:22:51 +04:00
parent 288c6d17fe
commit 4c345fc415
9 changed files with 131 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
deps/modcache.tar

66
Dockerfile Normal file
View File

@ -0,0 +1,66 @@
################################################################################
#2345678911234567892123456789312345678941234567895123456789612345678971234567898
################################################################################
FROM debian:bullseye-20221205
ENV DEBIAN_FRONTEND noninteractive
ENV NVM_DIR /usr/local/nvm
ENV GOROOT /usr/local/go
ENV PATH $PATH:/usr/local/go/bin
RUN --mount=type=cache,target=/var/cache/apt \
apt update && apt install -y \
--install-recommends \
build-essential \
curl \
jq \
make \
pv \
python3 \
python3-dev \
strace \
unzip \
vim \
wget \
zstd
COPY ./deps/* /tmp/
WORKDIR /tmp
RUN unzip protoc-*-linux-$(uname -m).zip -d /usr/local && protoc --version
RUN rm -rf /usr/local/go && \
tar -C /usr/local -xzf go*.linux-$(uname -m).tar.gz && \
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
RUN go version
RUN mkdir -p "$(go env GOMODCACHE)" && cd $(go env GOMODCACHE)/../ && tar xvf /tmp/modcache.tar && rm /tmp/modcache.tar && cd /tmp
RUN \
go install -v google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1 && \
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1 && \
go install -v mvdan.cc/gofumpt@latest && \
go install -v filippo.io/age/cmd/...@latest && \
go install -v golang.org/x/tools/cmd/godoc@latest && \
go install -v golang.org/x/tools/gopls@latest && \
go install -v github.com/klauspost/asmfmt/cmd/asmfmt@latest && \
go install -v github.com/go-delve/delve/cmd/dlv@latest && \
go install -v github.com/kisielk/errcheck@latest && \
go install -v github.com/davidrjenni/reftools/cmd/fillstruct@master && \
go install -v github.com/rogpeppe/godef@latest && \
go install -v golang.org/x/tools/cmd/goimports@master && \
go install -v github.com/mgechev/revive@latest && \
go install -v honnef.co/go/tools/cmd/staticcheck@latest && \
go install -v github.com/fatih/gomodifytags@latest && \
go install -v golang.org/x/tools/cmd/gorename@master && \
go install -v github.com/jstemmer/gotags@master && \
go install -v golang.org/x/tools/cmd/guru@master && \
go install -v github.com/josharian/impl@master && \
go install -v honnef.co/go/tools/cmd/keyify@master && \
go install -v github.com/fatih/motion@latest && \
go install -v github.com/koron/iferr@master && \
echo done
COPY ./setup.sh /tmp/
RUN bash /tmp/setup.sh

42
Makefile Normal file
View File

@ -0,0 +1,42 @@
export DOCKER_BUILDKIT := 1
export PROGRESS_NO_TRUNC := 1
APPNAME := builder
ARCH := $(shell uname -m)
GITREV := $(shell git describe --always --dirty=-dirty)
D := $(HOME)/Documents/_SYSADMIN/docker/sneak/$(APPNAME)
BRANCH := $(shell git branch --show-current)
RN := sneak/builder
export DOCKER_IMAGE_CACHE_DIR := $(HOME)/Library/Caches/Docker/$(APPNAME)-$(ARCH)
default: save
build: deps/modcache.tar
docker build \
-t $(RN):$(GITREV) \
-t $(RN):latest \
-t $(RN):$(shell git branch --show-current) \
--progress plain --build-arg GITREV=$(GITREV) .
save: $(D)/latest.tzst $(D)/$(BRANCH).tzst
$(D)/$(BRANCH).tzst: $(D)/$(GITREV).tzst
rm -f $@
ln -s $(D)/$(GITREV).tzst $@
$(D)/latest.tzst: $(D)/$(GITREV).tzst
rm -f $@
ln -s $(D)/$(GITREV).tzst $@
$D/$(GITREV).tzst:
-mkdir -p "$(D)"
docker save $(RN):$(GITREV) | pv | zstdmt -19 > $@.tmp
mv $@.tmp $@
push:
docker push $(RN):$(GITREV)
docker push $(RN):latest
docker push $(RN):$(shell git branch --show-current)
deps/modcache.tar:
cd $(shell go env GOMODCACHE)/../ && tar -c . | pv > $(PWD)/deps/modcache.tar

BIN
deps/go1.19.3.linux-aarch64.tar.gz vendored Normal file

Binary file not shown.

BIN
deps/go1.19.3.linux-x86_64.tar.gz vendored Normal file

Binary file not shown.

BIN
deps/node-v18.12.1-linux-arm64.tar.xz vendored Normal file

Binary file not shown.

BIN
deps/protoc-21.10-linux-aarch64.zip vendored Normal file

Binary file not shown.

BIN
deps/protoc-21.10-linux-x86_64.zip vendored Normal file

Binary file not shown.

22
setup.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
################################################################################
#2345678911234567892123456789312345678941234567895123456789612345678971234567898
################################################################################
cd /tmp
mkdir -p "$NVM_DIR"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
echo "export NVM_DIR=$NVM_DIR" >> /etc/profile
echo "source \$NVM_DIR/nvm.sh" >> /etc/profile
source /etc/profile
NCD="/usr/local/nvm/.cache/bin/node-v18.12.1-linux-arm64/"
mkdir -p "$NCD"
mv /tmp/node-v18.12.1-linux-arm64.tar.xz "$NCD"
nvm ls-remote
nvm install v18.12.1
nvm use v18.12.1
rm -rf "/usr/local/nvm/.cache"
npm install -g yarn