0
0
Fork 0
mirror of https://github.com/crazy-max/diun.git synced 2025-02-09 22:11:04 +00:00
crazy-max_diun/Dockerfile
dependabot[bot] 1e3d436a75
Bump github.com/containers/image/v5 from 5.9.0 to 5.10.1 (#265)
* Bump github.com/containers/image/v5 from 5.9.0 to 5.10.1

Bumps [github.com/containers/image/v5](https://github.com/containers/image) from 5.9.0 to 5.10.1.
- [Release notes](https://github.com/containers/image/releases)
- [Commits](https://github.com/containers/image/compare/v5.9.0...v5.10.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Add linux-headers

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-02-05 17:55:12 +00:00

46 lines
1.2 KiB
Docker

# syntax=docker/dockerfile:1.2
ARG GO_VERSION=1.15
ARG GORELEASER_VERSION=0.149.0
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
ARG GORELEASER_VERSION
RUN apk add --no-cache ca-certificates curl gcc file git linux-headers musl-dev tar
RUN wget -qO- https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_Linux_x86_64.tar.gz | tar -zxvf - goreleaser \
&& mv goreleaser /usr/local/bin/goreleaser
WORKDIR /src
FROM base AS gomod
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/go/pkg/mod \
go mod tidy && go mod download
FROM gomod AS build
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
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 \
./hack/goreleaser.sh
FROM scratch AS artifacts
COPY --from=build /out/*.tar.gz /
COPY --from=build /out/*.zip /
FROM --platform=$TARGETPLATFORM 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 DIUN_DB_PATH="/data/diun.db"
VOLUME [ "/data" ]
ENTRYPOINT [ "diun" ]