Skip to content

Commit dea4e8a

Browse files
authored
build: docker dev image on each main branch commit (#224)
Signed-off-by: Kush Sharma <[email protected]>
1 parent 5f9096d commit dea4e8a

File tree

4 files changed

+53
-3
lines changed

4 files changed

+53
-3
lines changed

.github/workflows/main.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Main
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
dev:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
- name: Set up Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: "1.20"
19+
- name: Login to DockerHub
20+
uses: docker/login-action@v1
21+
with:
22+
registry: docker.io
23+
username: ${{ secrets.DOCKERHUB_USERNAME }}
24+
password: ${{ secrets.DOCKERHUB_TOKEN }}
25+
- name: Publish dev image
26+
id: docker_dev_build
27+
uses: docker/build-push-action@v2
28+
with:
29+
push: true
30+
file: "./Dockerfile.dev"
31+
tags: raystack/compass:dev

Dockerfile.dev

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM golang:1.20-alpine3.17 as builder
2+
RUN apk add make
3+
WORKDIR /build/
4+
COPY . .
5+
RUN make build
6+
7+
FROM alpine:3.17
8+
9+
COPY --from=builder /build/compass /usr/bin/compass
10+
RUN apk update
11+
RUN apk add ca-certificates
12+
13+
# glibc compatibility library, since go binaries
14+
# don't work well with musl libc that alpine uses
15+
RUN apk add libc6-compat
16+
17+
ENTRYPOINT ["compass"]

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ coverage: test ## Print the code coverage
4141

4242
build: ## Build the compass binary
4343
@echo "Building guardian version ${VERSION}..."
44-
go build -ldflags "-X ${NAME}/cli.Version=${VERSION}"
44+
CGO_ENABLED=0 go build -ldflags "-X ${NAME}/cli.Version=${VERSION}"
4545
@echo "Build complete"
4646

4747
buildr: setup

internal/server/server.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ func Serve(
9090

9191
// init grpc
9292
grpcServer := grpc.NewServer(
93+
grpc.MaxRecvMsgSize(config.GRPC.MaxRecvMsgSize),
94+
grpc.MaxSendMsgSize(config.GRPC.MaxSendMsgSize),
9395
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
9496
grpc_recovery.UnaryServerInterceptor(),
9597
grpc_ctxtags.UnaryServerInterceptor(),
@@ -160,8 +162,8 @@ func Serve(
160162
ctx,
161163
mux.WithHTTPTarget(config.addr(), &http.Server{
162164
Handler: gwmux,
163-
ReadTimeout: 5 * time.Second,
164-
WriteTimeout: 10 * time.Second,
165+
ReadTimeout: 60 * time.Second,
166+
WriteTimeout: 60 * time.Second,
165167
IdleTimeout: 120 * time.Second,
166168
}),
167169
mux.WithGRPCTarget(config.grpcAddr(), grpcServer),

0 commit comments

Comments
 (0)