Upload files to "/"
This commit is contained in:
commit
47085614d7
1
COMMIT_EDITMSG
Normal file
1
COMMIT_EDITMSG
Normal file
@ -0,0 +1 @@
|
||||
First commit
|
||||
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM golang:1.20-alpine as build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY hello.go .
|
||||
|
||||
RUN go build -o hello hello.go
|
||||
|
||||
FROM alpine:3.16
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /app/hello .
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
RUN chmod 755 hello
|
||||
|
||||
CMD ["./hello"]
|
||||
10
config
Normal file
10
config
Normal file
@ -0,0 +1,10 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = false
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
symlinks = false
|
||||
ignorecase = true
|
||||
[remote "origin"]
|
||||
url = https://gitea.workload.cam/mi.aliyan/simple-server.git
|
||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||
1
description
Normal file
1
description
Normal file
@ -0,0 +1 @@
|
||||
Unnamed repository; edit this file 'description' to name the repository.
|
||||
36
hello.go
Normal file
36
hello.go
Normal file
@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt" // formatting and printing values to the console.
|
||||
"log" // logging messages to the console.
|
||||
"net/http" // Used for build HTTP servers and clients.
|
||||
)
|
||||
|
||||
// Port we listen on.
|
||||
const portNum string = ":8080"
|
||||
|
||||
// Handler functions.
|
||||
func Home(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Homepage")
|
||||
}
|
||||
|
||||
func Info(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Info page")
|
||||
}
|
||||
|
||||
func main() {
|
||||
log.Println("Starting our simple http server.")
|
||||
|
||||
// Registering our handler functions, and creating paths.
|
||||
http.HandleFunc("/", Home)
|
||||
http.HandleFunc("/info", Info)
|
||||
|
||||
log.Println("Started on port", portNum)
|
||||
fmt.Println("To close connection CTRL+C :-)")
|
||||
|
||||
// Spinning up the server.
|
||||
err := http.ListenAndServe(portNum, nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user