Browse Source

Adds support for serving static files and updates dockerfile

master
Noah Pederson 2 years ago
parent
commit
ce3c439702
3 changed files with 8 additions and 8 deletions
  1. +6
    -3
      Dockerfile
  2. +2
    -5
      cmd/main.go
  3. +0
    -0
      static/.gitkeep

+ 6
- 3
Dockerfile View File

@ -1,7 +1,10 @@
FROM scratch
FROM ubuntu
EXPOSE 8000
COPY plafws /
RUN mkdir /app
CMD [ "/plafws"]
COPY plafws /app/plafws
CMD [ "/app/plafws"]

+ 2
- 5
cmd/main.go View File

@ -13,13 +13,8 @@ import (
func main() {
// POSTGRES_USER := os.Getenv("POSTGRES_USER")
// POSTGRES_PASSWORD := os.Getenv("POSTGRES_PASSWORD")
// POSTGRES_ADDR := os.Getenv("POSTGRES_ADDR")
POSTGRES_URI := os.Getenv("POSTGRES_URI")
// connStr := fmt.Sprintf("host=%s user=%s password='%s' dbname=packetlostandfound sslmode=disable", POSTGRES_ADDR, POSTGRES_USER, POSTGRES_PASSWORD)
db, err := sql.Open("postgres", POSTGRES_URI)
if err != nil {
panic(err)
@ -34,6 +29,8 @@ func main() {
contact.BindEndpoints(r, contactService)
})
r.Handle("/*", http.FileServer(http.Dir("./static/")))
//Finally bind everything to the root endpoint
http.Handle("/", r)
log.Fatal(http.ListenAndServe(":8000", nil))


+ 0
- 0
static/.gitkeep View File


Loading…
Cancel
Save