Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfile to use distroless base image #869

Merged
merged 3 commits into from
Feb 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docs/
networks/
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 10 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]