-
Notifications
You must be signed in to change notification settings - Fork 451
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: build docker image for riscv64 platform
- Loading branch information
Showing
5 changed files
with
42 additions
and
39 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,39 +1,40 @@ | ||
FROM alpine AS build-env | ||
FROM --platform=$BUILDPLATFORM alpine as build-env | ||
COPY ./dist /dist | ||
RUN arch="$(apk --print-arch)"; \ | ||
case "$arch" in \ | ||
'x86_64') \ | ||
export FOLDER='default_linux_amd64_v1'; \ | ||
;; \ | ||
'armhf') \ | ||
export FOLDER='default_linux_arm_6'; \ | ||
;; \ | ||
'armv7') \ | ||
export FOLDER='default_linux_arm_7'; \ | ||
;; \ | ||
'aarch64') \ | ||
export FOLDER='default_linux_arm64'; \ | ||
;; \ | ||
'x86') \ | ||
export FOLDER='default_linux_386'; \ | ||
;; \ | ||
*) echo >&2 "error: unsupported architecture '$arch'"; exit 1 ;; \ | ||
esac \ | ||
&& mv /dist/$FOLDER /app ; \ | ||
RUN apk add --no-cache ca-certificates | ||
|
||
ARG TARGETPLATFORM | ||
RUN case $TARGETPLATFORM in \ | ||
'linux/386') \ | ||
export FOLDER='default_linux_386'; \ | ||
;; \ | ||
'linux/amd64') \ | ||
export FOLDER='default_linux_amd64_v1'; \ | ||
;; \ | ||
'linux/arm/v6') \ | ||
export FOLDER='default_linux_arm_6'; \ | ||
;; \ | ||
'linux/arm/v7') \ | ||
export FOLDER='default_linux_arm_7'; \ | ||
;; \ | ||
'linux/arm64') \ | ||
export FOLDER='default_linux_arm64'; \ | ||
;; \ | ||
'linux/riscv64') \ | ||
export FOLDER='default_linux_riscv64'; \ | ||
;; \ | ||
*) echo >&2 "error: unsupported architecture '$TARGETPLATFORM'"; exit 1 ;; \ | ||
esac \ | ||
&& mv /dist/$FOLDER /app ; \ | ||
rm /dist -rf | ||
|
||
FROM alpine | ||
|
||
FROM scratch | ||
|
||
WORKDIR /app | ||
COPY --from=build-env /app /app | ||
COPY --from=build-env \ | ||
/etc/ssl/certs/ca-certificates.crt \ | ||
/etc/ssl/certs/ca-certificates.crt | ||
COPY --from=build-env --chown=1000:1000 /app /app | ||
|
||
RUN apk -U upgrade --no-cache \ | ||
&& apk --no-cache add ca-certificates shadow tzdata \ | ||
&& groupadd -g 1000 glider \ | ||
&& useradd -r -u 1000 -g glider glider \ | ||
&& apk --no-cache del shadow \ | ||
&& chown -R glider:glider /app \ | ||
&& chmod +x /app/glider | ||
|
||
USER glider | ||
USER 1000 | ||
ENTRYPOINT ["./glider"] |
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
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