Skip to content

Commit

Permalink
ci: Use distroless container as runtime container
Browse files Browse the repository at this point in the history
  • Loading branch information
lrazovic committed Feb 14, 2023
1 parent f0cec4c commit 97aea40
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
File renamed without changes.
13 changes: 1 addition & 12 deletions Containerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@ COPY . /polimec
RUN cargo build --locked --release

# This is the 2nd stage: a very small image where we copy the Polkadot binary."
FROM docker.io/library/ubuntu:20.04
FROM gcr.io/distroless/cc
ARG PACKAGE
COPY --from=builder /polimec/target/release/$PACKAGE /usr/local/bin/polimec

RUN useradd -m -u 1000 -U -s /bin/sh -d /polimec polimec && \
mkdir -p /data /polimec/.local/share && \
chown -R polimec:polimec /data && \
ln -s /data /polimec/.local/share/polimec && \
# unclutter and minimize the attack surface
rm -rf /usr/bin /usr/sbin && \
# check if executable works in this container
/usr/local/bin/polimec --version

USER polimec

EXPOSE 30333 9933 9944 9615
VOLUME ["/data"]

Expand Down

0 comments on commit 97aea40

Please sign in to comment.