Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elops-od committed Dec 15, 2023
1 parent 55e5592 commit 45ee560
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o ./echo-server ./ma

######## Start a new stage from scratch #######
FROM alpine:3.19.0

ENV HTTP_PORT=8080
ENV HTTPS_PORT=8443
ENV GRPC_PORT=50051
ENV GRPCS_PORT=50053

EXPOSE 8080 8443 50051 50053

RUN apk add --no-cache ca-certificates bash curl jq yq busybox-extras \
&& rm -rf /var/lib/apk/lists/*

USER 1001
SHELL ["/bin/bash"]

WORKDIR /app
COPY ./certs /app/certs

COPY --from=builder /app/certs /app/certs
COPY --from=builder /app/echo-server /app/echo-server

ENTRYPOINT ["/app/echo-server"]
14 changes: 3 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
func main() {

httpPort := env.GetDefault("HTTP_PORT", "8080")
httpsPort := env.GetDefault("HTTP_PORT", "8443")
grpcPort := env.GetDefault("HTTP_PORT", "50051")
grpcsPort := env.GetDefault("HTTP_PORT", "50053")
httpsPort := env.GetDefault("HTTPS_PORT", "8443")
grpcPort := env.GetDefault("GRPC_PORT", "50051")
grpcsPort := env.GetDefault("GRPCS_PORT", "50053")

var wg sync.WaitGroup
wg.Add(1)
Expand Down Expand Up @@ -161,11 +161,3 @@ func (s *server) GrpcPing(ctx context.Context, req *pb.Request) (*pb.Response, e
}
return response, nil
}

func getEnv(key, defaultValue string) string {
value := os.Getenv(key)
if len(value) == 0 {
return defaultValue
}
return value
}

0 comments on commit 45ee560

Please sign in to comment.