-
Notifications
You must be signed in to change notification settings - Fork 1
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 #6 from PercussiveElbow/scratch_container
Scratch image base and drop root
- Loading branch information
Showing
1 changed file
with
10 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
# Build image to compile the app | ||
FROM crystallang/crystal:latest-alpine AS builder | ||
RUN apk --no-cache add ca-certificates | ||
RUN apk update && apk upgrade | ||
RUN apk update && apk upgrade && apk --no-cache add ca-certificates | ||
WORKDIR /app | ||
COPY . /app | ||
RUN adduser -S lowpriv | ||
COPY ./src /app/src/ | ||
RUN crystal build --static --release /app/src/crobat_client.cr | ||
FROM busybox:latest | ||
WORKDIR /app | ||
|
||
# Build the lightweight busybox based image | ||
FROM scratch | ||
COPY --from=builder /etc/passwd /etc/passwd | ||
COPY --from=builder /app/crobat_client /app/crobat_client | ||
COPY --from=builder /etc/ssl/certs /etc/ssl/certs | ||
RUN ln -s /etc/ssl/certs/ca-certificates.crt /etc/ssl/cert.pem | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/cert.pem | ||
USER lowpriv | ||
ENTRYPOINT ["/app/crobat_client"] |