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

Optimize Dockerfile #3800

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
FROM golang:1.21 AS build

# INSTALL DEPENDENCIES
WORKDIR /src
RUN go install github.com/gobuffalo/packr/v2/[email protected]
COPY go.mod go.sum /src/
RUN cd /src && go mod download
COPY go.mod go.sum ./
RUN go mod download

# BUILD BINARY
COPY . /src
RUN cd /src/db && packr2
RUN cd /src && make build
COPY . .
RUN packr2 && make build

# CONTAINER FOR RUNNING BINARY
FROM alpine:3.18

# INSTALL REQUIRED PACKAGES
RUN apk add --no-cache postgresql15-client

# COPY BUILT BINARY AND CONFIG FILE
COPY --from=build /src/dist/zkevm-node /app/zkevm-node
COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml
RUN apk update && apk add postgresql15-client

# SET EXECUTION ENVIRONMENT
WORKDIR /app
EXPOSE 8123
CMD ["/bin/sh", "-c", "/app/zkevm-node run"]
CMD ["./zkevm-node", "run"]