From d09aa00c4c0efb79fb966c0a1d39998a255c9ec3 Mon Sep 17 00:00:00 2001 From: smolgrrr Date: Sun, 19 Nov 2023 16:37:39 +1100 Subject: [PATCH] add dockerfile to pows_server --- pow_server/.gitignore | 2 ++ pow_server/Dockerfile | 23 +++++++++++++++++++++++ pow_server/main.go | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 pow_server/.gitignore create mode 100644 pow_server/Dockerfile diff --git a/pow_server/.gitignore b/pow_server/.gitignore new file mode 100644 index 0000000..eff50e2 --- /dev/null +++ b/pow_server/.gitignore @@ -0,0 +1,2 @@ +go.sum +main \ No newline at end of file diff --git a/pow_server/Dockerfile b/pow_server/Dockerfile new file mode 100644 index 0000000..946e8a2 --- /dev/null +++ b/pow_server/Dockerfile @@ -0,0 +1,23 @@ +# Start from the latest golang base image +FROM golang:latest + +# Set the Current Working Directory inside the container +WORKDIR /app + +# Copy go mod and sum files +COPY go.mod go.sum ./ + +# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed +RUN go mod download + +# Copy the source from the current directory to the Working Directory inside the container +COPY . . + +# Build the Go app +RUN go build -o main . + +# Expose port 8080 to the outside world +EXPOSE 8080 + +# Command to run the executable +CMD ["./main"] \ No newline at end of file diff --git a/pow_server/main.go b/pow_server/main.go index a70cfb0..32e5130 100644 --- a/pow_server/main.go +++ b/pow_server/main.go @@ -80,5 +80,5 @@ func handlePOW(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/powgen", handlePOW) - log.Fatal(http.ListenAndServe("127.0.0.1:8080", nil)) + log.Fatal(http.ListenAndServe("0.0.0.0:8080", nil)) }