-
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
56 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# syntax=docker/dockerfile:1 | ||
# # FROM args | ||
ARG ALPINE_TAG=3.19.1 | ||
ARG IMAGE_TAG=latest | ||
|
||
# # build image | ||
FROM redbean-build:${IMAGE_TAG} AS build | ||
|
||
# # final image | ||
FROM docker.io/library/alpine:${ALPINE_TAG} AS final | ||
|
||
# # set which command RUN should use | ||
SHELL [ "/bin/sh", "-c" ] | ||
|
||
# # environment variables | ||
ENV LANG=C.UTF-8 | ||
|
||
# # final args | ||
ARG USER=redbean | ||
ARG USER_ID=10000 | ||
ARG GROUP=cosmopolitanock | ||
ARG GROUP_ID=10001 | ||
ARG BIN_DIR=/usr/local/bin | ||
|
||
# # copy the $BIN_DIR | ||
COPY --from=build ${BIN_DIR} ${BIN_DIR} | ||
|
||
# # do multiple things | ||
RUN --mount=type=cache,target=/var/cache/apk <<EOT | ||
# # install ca-certificates | ||
apk update | ||
apk upgrade | ||
apk add --no-cache ca-certificates=20240226-r0 | ||
# # create USER:GROUP | ||
addgroup -G ${GROUP_ID} ${GROUP} | ||
adduser -u ${USER_ID} -G ${GROUP_ID} -h /home/cosmopolitan -D ${USER} | ||
chown ${USER_ID}:${GROUP_ID} -R -v ${BIN_DIR} | ||
# # normalize the binary to ELF | ||
redbean --assimilate | ||
EOT | ||
|
||
# # switch to the USER:GROUP | ||
USER ${USER_ID}:${GROUP_ID} | ||
|
||
# # switch to the working directory | ||
WORKDIR /home/${USER} | ||
|
||
# # start redbean when running the container | ||
ENTRYPOINT [ "redbean" ] |
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