Add some metadata and a Dockerfile

This commit is contained in:
Aaron Fischer 2023-09-28 22:40:00 +02:00
parent a984a7b936
commit fd43ebf6e9
4 changed files with 70 additions and 10 deletions

11
Dockerfile Normal file
View file

@ -0,0 +1,11 @@
FROM golang:alpine AS build
COPY . /app
WORKDIR /app
RUN GOOS=linux go generate
RUN GOOS=linux go build -o oko-spaceapi cmd/server.go
FROM alpine
WORKDIR /app
COPY --from=build /app/oko-spaceapi /app/oko-spaceapi
EXPOSE 8080
CMD ["/app/oko-spaceapi"]

View file

@ -11,21 +11,56 @@ func main() {
definition := spaceapi.Root{
// TODO: Fill up with stuff
ApiCompatibility: []string{"14"},
Links: []*spaceapi.LinksItems{
{
Description: "Out main website",
Name: "website",
Url: "https://okoyono.de",
},
},
Space: "økoyono",
Url: "https://okoyono.de/",
Space: "økoyono",
Url: "https://okoyono.de/",
Contact: &spaceapi.Contact{
Email: "contact@okoyono.de",
Email: "oko@datenhalter.de", // TODO: Better email
Mastodon: "@f@social.okoyono.de", // TODO: Replace with real handle
Matrix: "#public:matrix.okoyono.de",
},
Location: &spaceapi.Location{
Address: "",
},
Logo: "https://okoyono.de/images/ant.svg",
Links: []*spaceapi.LinksItems{
{
Description: "Main website",
Name: "website",
Url: "https://okoyono.de",
},
{
Description: "Forgejo SCM",
Name: "forgejo",
Url: "https://git.okoyono.de",
},
{
Description: "Mastodon",
Name: "mastodon",
Url: "https://social.okoyono.de",
},
},
Projects: []string{
"https://buchdesmonats.okoyono.de/",
"https://comicdesmonats.okoyono.de/",
"https://git.okoyono.de/okoyono/weatherstation",
},
Sensors: &spaceapi.Sensors{
TotalMemberCount: []*spaceapi.TotalMemberCountItems{
{
Description: "We are a small group of people from south Germany, meeting remote on a regular basis.",
Location: "Remote",
Value: 7,
},
},
//Temperature: []*spaceapi.TemperatureItems{
// {
// Location: "@f",
// Name: "weatherstatiøn",
// Description: "Weatherstatiøn located at @f.",
// Value: sensors.TemperatureF(),
// },
//},
},
}
json, err := definition.MarshalJSON()

8
docker-compose.yaml Normal file
View file

@ -0,0 +1,8 @@
version: "3"
services:
spaceapi:
build: .
restart: always
ports:
- "8080:8080"

6
pkg/sensors/wind.go Normal file
View file

@ -0,0 +1,6 @@
package sensors
func TemperatureF() float64 {
// TODO: Fetch from influxdb (or remove influxdb finally!)
return 10.0
}