Skip to content

Commit

Permalink
Add non-root user to Dockerfiles
Browse files Browse the repository at this point in the history
Add the mango user and specify in Dockerfiles.
  • Loading branch information
crainte committed Jun 8, 2022
1 parent 883e01b commit 5f19951
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ RUN make static || make static

FROM library/alpine

WORKDIR /
WORKDIR /app

RUN adduser -D --home /app -u 1000 mango

COPY --from=builder /Mango/mango /usr/local/bin/mango

USER 1000:1000

CMD ["/usr/local/bin/mango"]
7 changes: 6 additions & 1 deletion Dockerfile.arm32v7
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ COPY mango-arm32v7.o .

RUN cc 'mango-arm32v7.o' -o '/usr/local/bin/mango' -rdynamic -lxml2 -L/image_size.cr/ext/libwebp -lwebp -L/image_size.cr/ext/stbi -lstbi /myhtml/src/ext/modest-c/lib/libmodest_static.a -L/duktape.cr/src/.build/lib -L/duktape.cr/src/.build/include -lduktape -lm `pkg-config libarchive --libs` -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lgmp -lsqlite3 -lyaml -lpcre -lm /usr/lib/arm-linux-gnueabihf/libgc.so -lpthread /crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/bin/../lib/crystal/lib

CMD ["/usr/local/bin/mango"]
RUN useradd --home-dir /app -u 1000 mango

WORKDIR /app

USER 1000:1000

CMD ["/usr/local/bin/mango"]
6 changes: 6 additions & 0 deletions Dockerfile.arm64v8
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ COPY mango-arm64v8.o .

RUN cc 'mango-arm64v8.o' -o '/usr/local/bin/mango' -rdynamic -lxml2 -L/image_size.cr/ext/libwebp -lwebp -L/image_size.cr/ext/stbi -lstbi /myhtml/src/ext/modest-c/lib/libmodest_static.a -L/duktape.cr/src/.build/lib -L/duktape.cr/src/.build/include -lduktape -lm `pkg-config libarchive --libs` -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lgmp -lsqlite3 -lyaml -lpcre -lm /usr/lib/aarch64-linux-gnu/libgc.so -lpthread /crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/bin/../lib/crystal/lib

RUN useradd --home-dir /app -u 1000 mango

WORKDIR /app

USER 1000:1000

CMD ["/usr/local/bin/mango"]

0 comments on commit 5f19951

Please sign in to comment.