![minus](/assets/img/avatar_default.png)
* Use single server example as default frontend This just works out of the box * Refactor Dockerfile - Remove the asset dir since it's embedded in the executable anyway - Use the code in the current directory to build instead of downloading. Makes local testing very easy. - Cache Go dependencies - Run without root privileges. Note that using a BoltDB database requires mounting a volume with the correct permissions. The default database has thus been changed to memory so that starting the image just works. * Automatically publish images
19 lines
398 B
Docker
19 lines
398 B
Docker
FROM golang:1.18-alpine AS build_base
|
|
RUN apk add --no-cache git gcc ca-certificates libc-dev
|
|
WORKDIR /build
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY ./ ./
|
|
RUN go build -ldflags "-w -s" -trimpath -o speedtest .
|
|
|
|
FROM alpine:3.16
|
|
RUN apk add --no-cache ca-certificates
|
|
WORKDIR /app
|
|
COPY --from=build_base /build/speedtest ./
|
|
COPY settings.toml ./
|
|
|
|
USER nobody
|
|
EXPOSE 8989
|
|
|
|
CMD ["./speedtest"]
|