Skip to content

Commit

Permalink
Add docker container for generate protoc, mock, goyacc and regel
Browse files Browse the repository at this point in the history
  • Loading branch information
CBists committed Jan 11, 2024
1 parent 33c39a8 commit 515dc9b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@ yaccgen:

gen: gogen yaccgen mockgen

generate: build_images
docker compose up --remove-orphans generator
docker cp spqr-generator-1:/spqr/pkg/protos/. pkg/protos
docker cp spqr-generator-1:/spqr/yacc/console/. yacc/console

docker cp spqr-generator-1:/spqr/pkg/mock/pgx/mock_pgxconn_iface.go pkg/mock/pgx/mock_pgxconn_iface.go
docker cp spqr-generator-1:/spqr/pkg/mock/pgx/mock_pgx_tx.go pkg/mock/pgx/mock_pgx_tx.go
docker cp spqr-generator-1:/spqr/pkg/mock/conn/raw_mock.go pkg/mock/conn/raw_mock.go
docker cp spqr-generator-1:/spqr/router/mock/server/mock_server.go router/mock/server/mock_server.go
docker cp spqr-generator-1:/spqr/pkg/mock/conn/mock_instance.go pkg/mock/conn/mock_instance.go
docker cp spqr-generator-1:/spqr/pkg/mock/shard/mock_shard.go pkg/mock/shard/mock_shard.go
docker cp spqr-generator-1:/spqr/router/mock/client/mock_client.go router/mock/client/mock_client.go
docker cp spqr-generator-1:/spqr/router/mock/poolmgr/mock_pool_mgr.go router/mock/poolmgr/mock_pool_mgr.go
docker cp spqr-generator-1:/spqr/router/mock/qrouter/mock_qrouter.go router/mock/qrouter/mock_qrouter.go

version = $(shell git describe --tags --abbrev=0)
package:
sed -i 's/SPQR_VERSION/$(version)/g' debian/changelog
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,7 @@ services:
build:
dockerfile: ./docker/slicer/Dockerfile
context: .
generator:
build:
dockerfile: ./docker/generator/Dockerfile
context: .
13 changes: 13 additions & 0 deletions docker/generator/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM spqr-base-image

RUN apt-get update && apt-get install -y ragel && apt-get install -y protobuf-compiler
RUN cd $HOME
RUN wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz
RUN tar -xvf go1.21.6.linux-amd64.tar.gz
RUN export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
RUN go install google.golang.org/protobuf/cmd/[email protected]
RUN go install google.golang.org/grpc/cmd/[email protected]
RUN go install github.com/golang/mock/[email protected]
RUN go install golang.org/x/tools/cmd/[email protected]

ENTRYPOINT cd /spqr && make && make gen

0 comments on commit 515dc9b

Please sign in to comment.