Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
FROM hashicorp/terraform:1.13 AS terraform
FROM fullstorydev/grpcurl:v1.9.3 AS grpcurl

#################
# Build Go Binary
FROM golang:1.25-alpine3.21 AS build
WORKDIR /app
COPY src/ .
RUN go build -o toolbox

#######
# Image
FROM debian:13-slim
Expand All @@ -10,10 +17,8 @@ LABEL maintainer="Julian Nonino <noninojulian@gmail.com>"
# Args
ARG TARGETARCH

# Copy Terraform Binary
# Copy dependencies
COPY --from=terraform /bin/terraform /bin/terraform

# Copy gRPCurl Binary
COPY --from=grpcurl /bin/grpcurl /bin/grpcurl

# Install Tools
Expand All @@ -30,3 +35,9 @@ ENV KUBECTL_VERSION=v1.34.0
RUN curl -o /tmp/kubectl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" && \
install -o root -g root -m 0755 /tmp/kubectl /bin/kubectl && \
rm /tmp/kubectl

# Run the server
WORKDIR /app
COPY --from=build /app/toolbox /bin/toolbox
EXPOSE 8080
CMD ["/bin/toolbox"]
3 changes: 3 additions & 0 deletions src/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module toolbox

go 1.25
28 changes: 28 additions & 0 deletions src/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"fmt"
"log"
"net/http"
"os"
)

func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
host, _ := os.Hostname()
fmt.Fprintf(w, "<h1>Hostname: %s<h1>", host)
})

http.HandleFunc("/exitWithError", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Exit with Error")
os.Exit(1)
})

http.HandleFunc("/exitSuccess", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Exit Successfully")
os.Exit(0)
})

log.Println("Server is running at http://localhost:8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}