Skip to content

Commit 45d5c17

Browse files
committed
feat: reduced docker image size
1 parent 91cbe06 commit 45d5c17

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Dockerfile

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
FROM golang:1.12.9
2-
32
LABEL maintainer="Ren xiaohuo <[email protected]>"
4-
53
WORKDIR /app
6-
74
COPY ./ .
5+
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o zli main/main.go
86

9-
RUN go build -o $GOPATH/bin/zli main/main.go
7+
FROM alpine:latest
8+
RUN apk --no-cache add ca-certificates bash
9+
WORKDIR /app
10+
COPY --from=0 /app/ .
11+
RUN mv zli /bin/zli

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ go get ./...
2525
Run the following command to generate the `zli` binary:
2626

2727
```go
28-
go build -o zli main.go
28+
go build -o zli main/main.go
2929
```
3030

3131
### Install
@@ -147,9 +147,9 @@ zli contract call -a 305d5b3acaa2f4a56b5e149400466c58194e695f -t SubmitTransacti
147147
148148
### Running zli inside a Docker container
149149

150-
An alternative to running `zli` as a native binary is to build (or download) the `go-zli` Docker image, and to run `zli` from inside the container. This option requires prior installation of Docker (refer to the [Docker installation page](https://docs.docker.com/install/)).
150+
An alternative to running `zli` as a native binary is to build (or download) the `zli` Docker image, and to run `zli` from inside the container. This option requires prior installation of Docker (refer to the [Docker installation page](https://docs.docker.com/install/)).
151151

152-
1. Build the `go-zli` Docker image:
152+
1. Build the `zli` Docker image:
153153

154154
```bash
155155
sh build_docker_image.sh

0 commit comments

Comments
 (0)