-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile
36 lines (29 loc) · 924 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Build Stage
ARG GO_VERSION
FROM golang:$GO_VERSION-alpine AS build
RUN apk add --no-cache bash build-base git tree curl protobuf openssh
WORKDIR /src
ENV GOBIN=/bin
ENV ROOT_DIR=/src
# generate & build
ARG VERSION
ARG COMMIT
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go run mage.go deps build
FROM alpine
ARG VERSION
ARG COMMIT
LABEL org.opencontainers.image.version=$VERSION
LABEL org.opencontainers.image.source=/~https://github.com/opcr-io/policy
LABEL org.opencontainers.image.title="policy"
LABEL org.opencontainers.image.revision=$COMMIT
LABEL org.opencontainers.image.url="https://openpolicyregistry.io"
RUN apk add --no-cache bash
WORKDIR /app
COPY --from=build /src/dist/build_linux_amd64_v1/policy /app/
COPY --from=build /src/scripts /app/
RUN chmod +x /app/*.sh
ENV POLICY_FILE_STORE_ROOT=/github/workspace/_policy
ENTRYPOINT ["./policy"]