add dockerfile to pows_server

This commit is contained in:
smolgrrr 2023-11-19 16:37:39 +11:00
parent 8ca4d5bcbc
commit d09aa00c4c
3 changed files with 26 additions and 1 deletions

2
pow_server/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
go.sum
main

23
pow_server/Dockerfile Normal file
View File

@ -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"]

View File

@ -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))
}