Skip to content

Commit

Permalink
Merge pull request #55 from wunderio/feature/multistage-build
Browse files Browse the repository at this point in the history
Multistage build
  • Loading branch information
Jancis authored Sep 9, 2024
2 parents d206d44 + 0e08ce9 commit b02e177
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ REGISTRY_NAME=wunderio
IMAGE_NAME=csi-rclone
IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(VERSION)

.PHONY: all rclone-plugin clean rclone-container
.PHONY: all clean

all: plugin container push
all: build push

plugin:
go mod download
CGO_ENABLED=0 GOOS=linux go build -a -gcflags=-trimpath=$(go env GOPATH) -asmflags=-trimpath=$(go env GOPATH) -ldflags '-X github.com/wunderio/csi-rclone/pkg/rclone.DriverVersion=$(VERSION) -extldflags "-static"' -o _output/csi-rclone-plugin ./cmd/csi-rclone-plugin

container:
docker build -t $(IMAGE_TAG) -f ./cmd/csi-rclone-plugin/Dockerfile .

build:
docker build -t $(IMAGE_TAG) -f ./Dockerfile .

push:
docker push $(IMAGE_TAG)

Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,12 @@ Current code is referencing projects repository on github.com. If you fork the r

1. First push the changed code to remote. The build will use paths from `pkg/` directory.

2. Build the plugin
2. Build the plugin via multistage build and create docker image. `VERSION` file will be used as image tag.
```
make plugin
make build
```

3. Build the container and inject the plugin into it.
```
make container
```

4. Change docker.io account in `Makefile` and use `make push` to push the image to remote.
3. Change docker.io account in `Makefile` and use `make push` to push the image to remote.
```
make push
```
Expand Down

0 comments on commit b02e177

Please sign in to comment.