forked from letsencrypt/pebble
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
9 additions
and
43 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,28 +1,25 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# The build argument `APP` is used to select the appropriate binary | ||
# for the target OS. | ||
# The binary specified by `APP` must exist in the `dist-files` stage. | ||
ARG APP=${APP:-pebble} | ||
|
||
# Set the base image dynamically based on the target OS | ||
FROM --platform=${TARGETPLATFORM} \ | ||
alpine AS linux-base | ||
FROM --platform=${TARGETPLATFORM} \ | ||
mcr.microsoft.com/windows/nanoserver:ltsc2022 AS windows-base | ||
FROM --platform=${TARGETPLATFORM} alpine AS linux-base | ||
FROM --platform=${TARGETPLATFORM} mcr.microsoft.com/windows/nanoserver:ltsc2022 AS windows-base | ||
|
||
# Use build arguments to select the appropriate binary for Linux | ||
FROM linux-base AS linux | ||
ARG APP | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
COPY --from=dist-files /${APP} / | ||
CMD [ "${APP}" ] | ||
COPY --from=dist-files /${APP} /app | ||
CMD /app | ||
|
||
# Use build arguments to select the appropriate binary for Windows | ||
FROM windows-base AS windows | ||
ARG APP | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
COPY --from=dist-files /${APP}.exe / | ||
CMD [ "${APP}.exe" ] | ||
COPY --from=dist-files /${APP}.exe /app.exe | ||
CMD /app.exe | ||
|
||
# Final stage: dynamically select between Linux and Windows stages based on TARGETOS argument | ||
FROM ${TARGETOS} AS final |