0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-01-13 03:57:50 +00:00
crazy-max_diun/Dockerfile
CrazyMax de7eeadcd2
Fix profiler path (#339)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-04-25 21:07:23 +02:00

46 lines
1.2 KiB
Docker

# syntax=docker/dockerfile:1.2
ARG GO_VERSION=1.16
FROM --platform=$BUILDPLATFORM crazymax/goreleaser-xx:latest AS goreleaser-xx
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
COPY --from=goreleaser-xx / /
RUN apk add --no-cache ca-certificates gcc file git linux-headers musl-dev tar
WORKDIR /src
FROM base AS build
ARG TARGETPLATFORM
ARG GIT_REF
RUN --mount=type=bind,target=/src,rw \
--mount=type=cache,target=/root/.cache/go-build \
--mount=target=/go/pkg/mod,type=cache \
goreleaser-xx --debug \
--name "diun" \
--dist "/out" \
--hooks="go mod tidy" \
--hooks="go mod download" \
--main="./cmd/main.go" \
--ldflags="-s -w -X 'main.version={{.Version}}'" \
--files="CHANGELOG.md" \
--files="LICENSE" \
--files="README.md"
FROM scratch AS artifacts
COPY --from=build /out/*.tar.gz /
COPY --from=build /out/*.zip /
FROM alpine
LABEL maintainer="CrazyMax"
RUN apk --update --no-cache add \
ca-certificates \
libressl \
&& rm -rf /tmp/* /var/cache/apk/*
COPY --from=build /usr/local/bin/diun /usr/local/bin/diun
RUN diun --version
ENV PROFILER_PATH="/profiler" \
DIUN_DB_PATH="/data/diun.db"
VOLUME [ "/data", "/profiler" ]
ENTRYPOINT [ "diun" ]