FROM golang:alpine AS builder RUN apk add --no-cache gcc musl-dev sqlite-dev WORKDIR /build COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -o larc ./cmd/larc RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -o larcs ./cmd/larcs #runtime FROM alpine:edge RUN apk add --no-cache \ sqlite-libs \ ca-certificates \ apache2-utils \ && adduser -D -h /home/larc larc WORKDIR /app COPY --from=builder /build/larc /usr/local/bin/ COPY --from=builder /build/larcs /usr/local/bin/ COPY --from=builder /build/conf/larcs.example.yaml /etc/larcs/config.example.yaml RUN mkdir -p /var/lib/larcs/repos /etc/larcs \ && chown -R larc:larc /var/lib/larcs /etc/larcs ENV LARCS_CONFIG=/etc/larcs/config.yaml USER larc EXPOSE 8080 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \ CMD wget -q --spider http://localhost:8080/ || exit 1 CMD ["larcs", "-config", "/etc/larcs/config.yaml"]