File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,14 +8,14 @@ all: bin
88LDFLAGS ="-s -w -X $(PKG_NAME ) /internal.Version=${GIT_TAG}"
99
1010bin :
11- go build -ldflags=$(LDFLAGS ) -o bin/docker-compose$(EXTENSION ) ./main.go
11+ CGO_ENABLED=0 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose$(EXTENSION ) ./main.go
1212
1313cross :
14- GOOS=linux GOARCH=amd64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-linux-amd64 .
15- GOOS=linux GOARCH=arm64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-linux-arm64 .
16- GOOS=darwin GOARCH=amd64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-darwin-amd64 .
17- GOOS=darwin GOARCH=arm64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-darwin-arm64 .
18- GOOS=windows GOARCH=amd64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-windows-amd64.exe .
14+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-linux-amd64 .
15+ CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-linux-arm64 .
16+ CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-darwin-amd64 .
17+ CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-darwin-arm64 .
18+ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags=$(LDFLAGS ) -o bin/docker-compose-windows-amd64.exe .
1919
2020test :
2121 go test -cover $(shell go list $(TAGS ) ./... | grep -vE 'e2e')
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ COMPOSE_SWITCH_VERSION=" 1.0.0"
4+ COMPOSE_SWITCH_URL=" https://github.com/docker/compose-switch/releases/download/$COMPOSE_SWITCH_VERSION /docker-compose"
5+ DOCKER_COMPOSE_V1_PATH_ORIG=" $( which docker-compose) "
6+ DOCKER_COMPOSE_V1_PATH_NEW=" $DOCKER_COMPOSE_V1_PATH_ORIG -v1"
7+
8+ if [ ! -f " ${DOCKER_COMPOSE_V1_PATH_ORIG} " ]; then
9+ echo " 'docker-compose' V1 could not be found in PATH. Aborting..."
10+ exit 1
11+ fi
12+
13+ if [ -f " ${DOCKER_COMPOSE_V1_PATH_NEW} " ]; then
14+ echo " Looks like docker-compose V1->V2 switch is already installed. 'docker-compose' binary was already moved to '${DOCKER_COMPOSE_V1_PATH_NEW} '."
15+ echo " If you are trying to re-enable Docker Compose V2, please run:"
16+ echo " $ docker-compose enable-v2"
17+ exit 0
18+ fi
19+
20+ error=$( docker compose version 2>&1 > /dev/null)
21+ if [ $? -ne 0 ]; then
22+ echo " Docker Compose V2 is not installed"
23+ exit 1
24+ fi
25+
26+ TMP_FILE=$( mktemp)
27+ echo " Downloading compose V1->V2 switch into $TMP_FILE ..."
28+ curl -L -o " $TMP_FILE " " $COMPOSE_SWITCH_URL "
29+ chmod +x " $TMP_FILE "
30+
31+ echo " Switching Docker Compose binary"
32+ mv " $DOCKER_COMPOSE_V1_PATH_ORIG " " $DOCKER_COMPOSE_V1_PATH_NEW "
33+ mv " $TMP_FILE " " $DOCKER_COMPOSE_V1_PATH_ORIG "
34+
35+ echo " Compose V1->V2 installed"
36+
37+ $DOCKER_COMPOSE_V1_PATH_ORIG enable-v2
38+ echo " Docker Compose V2 enabled"
39+ docker-compose version
40+
41+ echo " To switch back to Compose V1, you can run: ` docker-compose disable-v2` "
You can’t perform that action at this time.
0 commit comments