Skip to content

Commit

Permalink
Dev: Replace the Python-based http server by a Go-based http server
Browse files Browse the repository at this point in the history
Remove the dependency on Python in favor of just using Go's standard
library http server to serve the web app for local development purposes.

Signed-off-by: Eric Cornelissen <ericornelissen@gmail.com>
  • Loading branch information
ericcornelissen committed Dec 14, 2024
1 parent c588b7a commit b558952
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Containerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
FROM docker.io/golang:1.23.0-alpine3.19

RUN apk add --no-cache \
bash git perl-utils python3 zip \
bash git perl-utils zip \
&& \
echo "alias gask='go run tasks.go'" >~/.bashrc \
&& \
Expand Down
5 changes: 3 additions & 2 deletions tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"go/token"
"io"
"io/fs"
"net/http"
"os"
"os/exec"
"regexp"
Expand Down Expand Up @@ -623,8 +624,8 @@ func TaskWebServe(t *T) error {
}

t.Log("Serving locally...")
t.Cd(webDir)
return t.Exec("python3 -m http.server 8080")
http.Handle("/", http.FileServer(http.Dir("web")))
return http.ListenAndServe(":8080", nil)
}

// -------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit b558952

Please sign in to comment.