From 6542293e963be32dd10e4d794a24ce259495aa09 Mon Sep 17 00:00:00 2001 From: Niccolo Raspa Date: Tue, 15 Feb 2022 12:08:04 +0100 Subject: [PATCH 1/3] Update Dockerfile to use distroless base image --- Dockerfile | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 00ba032c35e..a263e9f2ffc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,22 @@ -FROM faddat/archlinux AS build +# syntax=docker/dockerfile:1 -ENV GOPATH=/go -ENV PATH=$PATH:/go/bin +## Build +FROM golang:1.17-bullseye as build -# Set up dependencies -RUN pacman -Syyu --noconfirm curl make git go gcc linux-headers python base-devel protobuf wget && \ - wget -O /genesis.json https://github.com/osmosis-labs/networks/raw/main/osmosis-1/genesis.json - - -# Add source files +WORKDIR /osmosis COPY . /osmosis +RUN make build -# Install minimum necessary dependencies, build Cosmos SDK, remove packages -RUN cd /osmosis && \ - make install - -# Final image -FROM faddat/archlinux +## Deploy +FROM gcr.io/distroless/base-debian11 -RUN pacman -Syyu --noconfirm +WORKDIR / -# Copy over binaries from the build-env -COPY --from=build /go/bin/osmosisd /usr/bin/osmosisd -COPY --from=build /genesis.json /genesis.json +COPY --from=build /osmosis/build/osmosisd /osmosisd -# Run osmosisd by default, omit entrypoint to ease using container with osmosiscli EXPOSE 26656 EXPOSE 26657 EXPOSE 1317 EXPOSE 9090 +ENTRYPOINT ["/osmosisd"] \ No newline at end of file From 1f773e6fea1985a84b568479c4dc9d6b621cb086 Mon Sep 17 00:00:00 2001 From: Niccolo Raspa Date: Tue, 15 Feb 2022 12:23:07 +0100 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36d2dfa7f85..47e1e213f57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- [#869](https://github.com/osmosis-labs/osmosis/pull/869) Update Dockerfile to use distroless base image. - [#856](https://github.com/osmosis-labs/osmosis/pull/856) Make superfluid staking keeper in app.go a pointer receiver. - [#765](https://github.com/osmosis-labs/osmosis/pull/765) Fix a bug in `Makefile` regarding the location of localtestnet docker image. - [#795](https://github.com/osmosis-labs/osmosis/pull/795) Annotate app.go From 04b91fb1b5cc86cfdd1b9deebc989333ca694cb9 Mon Sep 17 00:00:00 2001 From: Niccolo Raspa Date: Tue, 15 Feb 2022 15:33:50 +0100 Subject: [PATCH 3/3] Add dockerignore to reduce docker build size --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..4327498f555 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +docs/ +networks/