Dockerfile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Start from the latest alpine based golang base image
  2. FROM golang:alpine as builder
  3. # Install git
  4. RUN apk update && apk add --no-cache git
  5. # Add maintainer info
  6. LABEL maintainer="Matthias Ladkau <matthias@ladkau.de>"
  7. # Set the current working directory inside the container
  8. WORKDIR /app
  9. # Copy go mod and sum files
  10. COPY go.mod go.sum ./
  11. # Download all dependencies
  12. RUN go mod download
  13. # Copy the source from the current directory to the working directory inside the container
  14. COPY . .
  15. # Build rufs and link statically (no CGO)
  16. # Use ldflags -w -s to omit the symbol table, debug information and the DWARF table
  17. RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags="-w -s" ./server/dudeldu.go
  18. # Start again from scratch
  19. FROM scratch
  20. # Copy the rufs binary
  21. COPY --from=builder /app/dudeldu /dudeldu
  22. # Set the working directory to data so all created files (e.g. rufs.config.json)
  23. # can be mapped to physical files on disk
  24. WORKDIR /data
  25. # Run eliasdb binary
  26. ENTRYPOINT ["../dudeldu"]
  27. # To run the dudeldu as the current user, expose port 9091 and map
  28. # all files in the current directory run:
  29. #
  30. # docker run --rm --user $(id -u):$(id -g) -v $PWD:/data -p 9091:9091 krotik/dudeldu -host 0.0.0.0 <playlist>