Compare commits
10 Commits
main
...
8605f39f53
| Author | SHA1 | Date | |
|---|---|---|---|
| 8605f39f53 | |||
| aa601454fd | |||
| 90bf0bcb73 | |||
| 2c70f0660e | |||
| 9f85187b21 | |||
| 4df3116475 | |||
| 42bbe1fa21 | |||
| 7fc73921d3 | |||
| e8d042b65e | |||
| 853bee22db |
@@ -18,5 +18,6 @@ jobs:
|
|||||||
go-version: '1.24.4'
|
go-version: '1.24.4'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Containerize app
|
- name: Containerize app
|
||||||
run: exit 0
|
run: |
|
||||||
|
echo "Still needs to be implemented."
|
||||||
|
exit 1
|
||||||
|
|||||||
@@ -18,5 +18,7 @@ jobs:
|
|||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Test functions module
|
- name: Test functions module
|
||||||
run: go test ./functions -v
|
run: go test ./functions -v
|
||||||
|
working-directory: ./code
|
||||||
- name: Test actual build
|
- name: Test actual build
|
||||||
run: go build
|
run: go build
|
||||||
|
working-directory: ./code
|
||||||
|
|||||||
25
.gitignore
vendored
25
.gitignore
vendored
@@ -1,26 +1,3 @@
|
|||||||
# Allowlisting gitignore template for GO projects prevents us
|
|
||||||
# from adding various unwanted local files, such as generated
|
|
||||||
# files, developer configurations or IDE-specific files etc.
|
|
||||||
#
|
|
||||||
# Recommended: Go.AllowList.gitignore
|
|
||||||
|
|
||||||
# Ignore everything
|
|
||||||
*
|
|
||||||
|
|
||||||
.env
|
.env
|
||||||
# But not these files...
|
.swp
|
||||||
!/.gitignore
|
|
||||||
|
|
||||||
!*.go
|
|
||||||
!go.sum
|
|
||||||
!go.mod
|
|
||||||
|
|
||||||
!README.md
|
|
||||||
!LICENSE
|
|
||||||
|
|
||||||
# !Makefile
|
|
||||||
|
|
||||||
# ...even if they are in subdirectories
|
|
||||||
!*/
|
|
||||||
!.gitea/*
|
|
||||||
!.gitea/workflows/*
|
|
||||||
|
|||||||
16
code/.gitignore
vendored
Normal file
16
code/.gitignore
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Allowlisting gitignore template for GO projects prevents us
|
||||||
|
# from adding various unwanted local files, such as generated
|
||||||
|
# files, developer configurations or IDE-specific files etc.
|
||||||
|
#
|
||||||
|
# Recommended: Go.AllowList.gitignore
|
||||||
|
|
||||||
|
# Ignore everything
|
||||||
|
*
|
||||||
|
|
||||||
|
.env
|
||||||
|
# But not these files...
|
||||||
|
!/.gitignore
|
||||||
|
|
||||||
|
!*.go
|
||||||
|
!go.sum
|
||||||
|
!go.mod
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
module darjeeling.systemec.nl/rhouben/fibonacci
|
module darjeeling.systemec.nl/rhouben/fibonacci
|
||||||
|
replace darjeeling.systemec.nl/rhouben/fibonacci/functions => ./functions
|
||||||
|
|
||||||
go 1.24.4
|
go 1.24.4
|
||||||
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"flag"
|
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
port_arg := os.Getenv("FIB_PORT")
|
port_arg := os.Getenv("FIB_PORT")
|
||||||
if port_arg != "" {
|
if port_arg != "" {
|
||||||
fmt.Printf("Loaded port value '%s' from environment.\n",port_arg)
|
fmt.Printf("Loaded port value '%s' from environment.\n", port_arg)
|
||||||
port_number, error = strconv.Atoi(port_arg)
|
port_number, error = strconv.Atoi(port_arg)
|
||||||
if error != nil {
|
if error != nil {
|
||||||
fmt.Printf("I had an error trying to parse '%s' into a number: %s\n",
|
fmt.Printf("I had an error trying to parse '%s' into a number: %s\n",
|
||||||
@@ -33,9 +33,9 @@ func main() {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flag.IntVar(&port, "port", 8098,
|
flag.IntVar(&port, "port", 8098,
|
||||||
fmt.Sprintf("Port number to bind to, default %d", port_number))
|
fmt.Sprintf("Port number to bind to, default %d", port_number))
|
||||||
flag.IntVar(&seq, "number", 0,
|
flag.IntVar(&seq, "number", 0,
|
||||||
"Fibonacci sequence value to calculate")
|
"Fibonacci sequence value to calculate")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
19
docker/Dockerfile
Normal file
19
docker/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
FROM golang:1.24-bookworm AS base
|
||||||
|
|
||||||
|
# /build is the working directory
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
# Copy control files and pull in dependencies
|
||||||
|
COPY code/ ./
|
||||||
|
RUN go mod tidy \
|
||||||
|
&& go mod download
|
||||||
|
|
||||||
|
ENV port=8089
|
||||||
|
|
||||||
|
# Build the app
|
||||||
|
|
||||||
|
RUN go build -o fibonacci
|
||||||
|
|
||||||
|
EXPOSE ${port}
|
||||||
|
|
||||||
|
CMD ["build/fibonacci"]
|
||||||
Reference in New Issue
Block a user