-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1000 from flanksource/minimal-image
feat: generate minimal and elevated base images
- Loading branch information
Showing
9 changed files
with
55 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM golang:1.20 AS builder | ||
WORKDIR /app | ||
|
||
ARG NAME | ||
ARG VERSION | ||
ENV IMAGE_TYPE=minimal | ||
COPY go.mod /app/go.mod | ||
COPY go.sum /app/go.sum | ||
RUN go mod download | ||
COPY ./ ./ | ||
RUN go version | ||
RUN make build | ||
|
||
FROM ubuntu | ||
WORKDIR /app | ||
RUN apt-get update && \ | ||
apt-get install -y curl unzip ca-certificates jq wget gnupg2 bzip2 --no-install-recommends && \ | ||
rm -Rf /var/lib/apt/lists/* && \ | ||
rm -Rf /usr/share/doc && rm -Rf /usr/share/man && \ | ||
apt-get clean | ||
|
||
COPY --from=builder /app/.bin/canary-checker /app | ||
|
||
RUN /app/canary-checker go-offline | ||
|
||
RUN mkdir /opt/database | ||
RUN groupadd --gid 1000 canary | ||
RUN useradd canary --uid 1000 -g canary -m -d /var/lib/canary | ||
RUN chown -R 1000:1000 /opt/database | ||
USER canary:canary | ||
|
||
ENTRYPOINT ["/app/canary-checker"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters