-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
43 lines (30 loc) · 944 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
37
38
39
40
41
42
43
# --- build stage
FROM golang:1.19 AS builder
WORKDIR /builder/app
COPY go/src/app/ .
COPY go.mod .
RUN go get -d -v . &&\
go build -v -o /go/bin/app .
RUN go test -v -coverprofile=coverage.out -covermode=atomic
# go tool cover -func=coverage.out
# --- Publish test coverage results
FROM scratch as test-coverage
COPY --from=builder /builder/app/coverage.out .
# --- Production image
FROM ubuntu:latest
LABEL Name=kapparmor
LABEL Author="Affinito Alessandro"
WORKDIR /app
RUN apt-get update &&\
apt-get upgrade -y &&\
apt-get install --no-install-recommends --yes apparmor apparmor-utils &&\
rm -rf /var/lib/apt/lists/* &&\
mkdir --parent --verbose /etc/apparmor.d/custom
COPY --from=builder /go/bin/app /app/
COPY ./charts/kapparmor/profiles /app/profiles/
ARG PROFILES_DIR
ARG POLL_TIME
ENV PROFILES_DIR=$PROFILES_DIR
ENV POLL_TIME=$POLL_TIME
USER root
CMD ./app