Skip to content

Commit

Permalink
Add nonroot user to quarto+shinylive
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Solymos <psolymos@gmail.com>
  • Loading branch information
psolymos committed Jul 12, 2024
1 parent 39d866f commit 7479cc1
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM ghcr.io/openfaas/of-watchdog:0.10.1 AS watchdog

FROM alpine:3.20
COPY app /app

RUN adduser -D app
USER app
WORKDIR /home/app
COPY app .

COPY --from=watchdog /fwatchdog .
ENV mode="static"
ENV static_path="/app"
ENV static_path="/home/app"
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD ["./fwatchdog"]
8 changes: 5 additions & 3 deletions quarto-py-shinylive/Dockerfile.multi
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
RUN quarto add quarto-ext/shinylive --no-prompt
RUN quarto render /root/app/index.qmd --output-dir /root/output


FROM ghcr.io/openfaas/of-watchdog:0.10.1 AS watchdog

FROM alpine:3.20
COPY --from=builder /root/output /app
RUN adduser -D app
USER app
WORKDIR /home/app
COPY --from=builder /root/output /home/app
COPY --from=watchdog /fwatchdog .
ENV mode="static"
ENV static_path="/app"
ENV static_path="/home/app"
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD ["./fwatchdog"]
2 changes: 1 addition & 1 deletion quarto-py-shinylive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export DOCKER_DEFAULT_PLATFORM=linux/amd64
export NAME=faithful/quarto-py-shinylive

# Build image
docker build -t ${NAME}:of -f Dockerfile.of .
docker build -t ${NAME}:of -f Dockerfile .

# Run image, visit http://localhost:8080
docker run --rm -p 8080:8080 ${NAME}:of
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM ghcr.io/openfaas/of-watchdog:0.10.1 AS watchdog

FROM alpine:3.20
COPY app /app

RUN adduser -D app
USER app
WORKDIR /home/app
COPY app .

COPY --from=watchdog /fwatchdog .
ENV mode="static"
ENV static_path="/app"
ENV static_path="/home/app"
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD ["./fwatchdog"]
8 changes: 5 additions & 3 deletions quarto-r-shinylive/Dockerfile.multi
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ COPY quarto-r-shinylive/index.qmd /root/app/index.qmd
RUN quarto add quarto-ext/shinylive --no-prompt
RUN quarto render /root/app/index.qmd --output-dir /root/output


FROM ghcr.io/openfaas/of-watchdog:0.10.1 AS watchdog

FROM alpine:3.20
COPY --from=builder /root/output /app
RUN adduser -D app
USER app
WORKDIR /home/app
COPY --from=builder /root/output /home/app
COPY --from=watchdog /fwatchdog .
ENV mode="static"
ENV static_path="/app"
ENV static_path="/home/app"
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
CMD ["./fwatchdog"]
2 changes: 1 addition & 1 deletion quarto-r-shinylive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export DOCKER_DEFAULT_PLATFORM=linux/amd64
export NAME=faithful/quarto-r-shinylive

# Build image
docker build -t ${NAME}:of -f Dockerfile.of .
docker build -t ${NAME}:of -f Dockerfile .

# Run image, visit http://localhost:8080
docker run --rm -p 8080:8080 ${NAME}:of
Expand Down

0 comments on commit 7479cc1

Please sign in to comment.