This commit is contained in:
Aaron Fischer 2022-11-27 23:39:35 +01:00
commit 86a77515f1
Signed by: f
GPG Key ID: 91E0B20B3853F1B9
4 changed files with 44 additions and 0 deletions

9
Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM golang:alpine as build
WORKDIR /root
COPY . .
RUN go build
FROM alpine
COPY --from=build /root/test /root/test
EXPOSE 5000
ENTRYPOINT ["/root/test"]

11
README.md Normal file
View File

@ -0,0 +1,11 @@
# Firewall test container
## Build
$ docker build -t git.okoyono.de/f/firewall-test:latest .
$ docker push git.okoyono.de/f/firewall-test:latest
## Run
$ docker pull git.okoyono.de/f/firewall-test
$ docker run git.okoyono.de/f/firewall-test

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module test
go 1.19

21
test.go Normal file
View File

@ -0,0 +1,21 @@
package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
resp, err := http.Get("https://aaron-fischer.net/ryg")
if err != nil {
fmt.Printf("err: %v", err)
}
fmt.Printf("Resp: %v", resp.Status)
fmt.Fprintf(w, "Request from within the container to a website (Port 443): %v", resp.Status)
})
log.Fatal(http.ListenAndServe(":5000", nil))
}