0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-03-17 04:42:39 +00:00
crazy-max_diun/Dockerfile

47 lines
1.2 KiB
Text
Raw Normal View History

# syntax=docker/dockerfile:1.2
ARG GO_VERSION=1.16
2020-05-25 12:18:54 +00:00
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
2020-11-08 00:16:33 +00:00
WORKDIR /src
FROM base AS build
2020-07-10 18:46:44 +00:00
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"
2019-06-04 20:11:54 +00:00
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
2019-06-04 20:11:54 +00:00
ENV PROFILER_PATH="/profiler" \
DIUN_DB_PATH="/data/diun.db"
2019-08-22 19:20:17 +00:00
VOLUME [ "/data", "/profiler" ]
ENTRYPOINT [ "diun" ]