Skip to content

Commit

Permalink
fix: update to go1.19 in the Dockerfile and add asdf support
Browse files Browse the repository at this point in the history
Signed-off-by: D4ryl00 <d4ryl00@gmail.com>
  • Loading branch information
D4ryl00 committed Jun 26, 2023
1 parent 3de041b commit 281ca19
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ $(gen_sum): $(gen_src)
--workdir="/go/src/berty.tech/weshnet" \
--entrypoint="sh" \
--rm \
bertytech/buf:1 \
bertytech/buf:2 \
-xec 'make generate_local'; \
$(MAKE) tidy \
)
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $(gen_sum): $(gen_src)
--workdir="/go/src/berty.tech/berty/docs" \
--entrypoint="sh" \
--rm \
bertytech/buf:1 \
bertytech/buf:2 \
-xec 'make generate_local' \
)
.PHONY: generate
Expand Down
18 changes: 13 additions & 5 deletions tool/docker-protoc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
FROM moul/protoc-gen-gotemplate:latest as pgg

# build image
FROM golang:1.18-alpine as builder
FROM golang:1.19-alpine as builder
# install deps
RUN apk --no-cache add make git go rsync libc-dev openssh docker npm
RUN apk --no-cache add make git go rsync libc-dev openssh docker npm bash curl
# ensure we use bash for all RUN commands
SHELL ["/bin/bash", "-c"]
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0 && \
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
# install compilers
WORKDIR $GOPATH/src/berty.tech/weshnet
COPY go.mod go.sum ./
COPY go.mod go.sum .tool-versions ./
# ensure modifications to bashrc are properly sourced
ENV BASH_ENV=~/.bashrc
# @TODO(gfanton): use asdf version
RUN go install -mod=readonly \
github.com/bufbuild/buf/cmd/buf \ # @TODO(gfanton): use asdf version
google.golang.org/protobuf/cmd/protoc-gen-go \
github.com/gogo/protobuf/protoc-gen-gogo \
google.golang.org/grpc/cmd/protoc-gen-go-grpc \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc \
golang.org/x/tools/cmd/goimports
RUN asdf plugin add buf && asdf install buf && \
cp $(asdf which buf) /go/bin/buf

# runtime
FROM golang:1.18-alpine
FROM golang:1.19-alpine
RUN apk --no-cache add git openssh make protobuf gcc libc-dev nodejs npm yarn sudo perl-utils tar sed grep \
&& mkdir -p /.cache/go-build \
&& chmod -R 777 /.cache \
Expand Down
2 changes: 1 addition & 1 deletion tool/docker-protoc/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
IMAGE ?= bertytech/buf
VERSION ?= 1
VERSION ?= 2

build:
cd ../../ && docker build -f ./tool/docker-protoc/Dockerfile -t $(IMAGE):$(VERSION) -t $(IMAGE):latest .
Expand Down

0 comments on commit 281ca19

Please sign in to comment.