Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit 64cd8eb

Browse files
authored
Merge pull request #632 from docker/eula-packaging
Add Docker EULA to packages
2 parents d42a931 + dd57e9e commit 64cd8eb

File tree

8 files changed

+85
-31
lines changed

8 files changed

+85
-31
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.git/
22
bin/
3+
dist/
34
tests/node-client/node_modules/

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
${{ runner.os }}-go-
2626
2727
- name: Build
28-
run: make -f builder.Makefile cross
28+
run: make -f builder.Makefile package
2929

3030
- uses: ncipollo/release-action@v1
3131
with:
32-
artifacts: "bin/*"
32+
artifacts: "dist/*"
3333
prerelease: true
3434
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
bin/
2+
dist/

builder.Makefile

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,39 +32,59 @@ GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
3232
BINARY?=bin/docker
3333
BINARY_WITH_EXTENSION=$(BINARY)$(EXTENSION)
3434

35+
WORK_DIR:=$(shell mktemp -d)
36+
3537
TAGS:=
3638
ifdef BUILD_TAGS
3739
TAGS=-tags $(BUILD_TAGS)
3840
endif
3941

42+
TAR_TRANSFORM:=--transform s/packaging/docker/ --transform s/bin/docker/ --transform s/docker-linux-amd64/docker/ --transform s/docker-darwin-amd64/docker/
43+
ifneq ($(findstring bsd,$(shell tar --version)),)
44+
TAR_TRANSFORM=-s /packaging/docker/ -s /bin/docker/ -s /docker-linux-amd64/docker/ -s /docker-darwin-amd64/docker/
45+
endif
46+
4047
all: cli
4148

49+
.PHONY: protos
4250
protos:
4351
protoc -I. --go_out=plugins=grpc,paths=source_relative:. ${PROTOS}
4452

53+
.PHONY: cli
4554
cli:
4655
GOOS=${GOOS} GOARCH=${GOARCH} $(GO_BUILD) $(TAGS) -o $(BINARY_WITH_EXTENSION) ./cli
4756

57+
.PHONY: cross
4858
cross:
4959
GOOS=linux GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(BINARY)-linux-amd64 ./cli
5060
GOOS=darwin GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(BINARY)-darwin-amd64 ./cli
5161
GOOS=windows GOARCH=amd64 $(GO_BUILD) $(TAGS) -o $(BINARY)-windows-amd64.exe ./cli
5262

63+
.PHONY: test
5364
test:
5465
go test $(TAGS) -cover $(shell go list ./... | grep -vE 'e2e')
5566

67+
.PHONY: lint
5668
lint:
5769
golangci-lint run --timeout 10m0s ./...
5870

71+
.PHONY: import-restrictions
5972
import-restrictions:
6073
import-restrictions --configuration import-restrictions.yaml
6174

75+
.PHONY: check-licese-headers
6276
check-license-headers:
6377
./scripts/validate/fileheader
6478

79+
.PHONY: check-go-mod
6580
check-go-mod:
6681
./scripts/validate/check-go-mod
6782

68-
FORCE:
69-
70-
.PHONY: all protos cli cross test lint
83+
.PHONY: package
84+
package: cross
85+
mkdir -p dist
86+
tar -czf dist/docker-linux-amd64.tar.gz $(TAR_TRANSFORM) packaging/LICENSE $(BINARY)-linux-amd64
87+
tar -czf dist/docker-darwin-amd64.tar.gz $(TAR_TRANSFORM) packaging/LICENSE $(BINARY)-darwin-amd64
88+
cp $(BINARY)-windows-amd64.exe $(WORK_DIR)/docker.exe
89+
rm -f dist/docker-windows-amd64.zip && zip dist/docker-windows-amd64.zip -j packaging/LICENSE $(WORK_DIR)/docker.exe
90+
rm -r $(WORK_DIR)

packaging/LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The Docker End User License Agreement (https://www.docker.com/legal/docker-software-end-user-license-agreement) describes Docker's Terms for this software.
2+
By downloading, accessing, or using this software you expressly accept and agree to the Terms set out in the Docker End User License Agreement.

scripts/install/Dockerfile-testInstall

Lines changed: 0 additions & 14 deletions
This file was deleted.

scripts/install/install_linux.sh

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# Script to install the Docker ACI integration CLI on Ubuntu (Beta).
17+
# Script to install the Docker Compose CLI on Ubuntu (Beta).
1818

1919
set -eu
2020

@@ -106,18 +106,19 @@ if ! [ "$(command -v curl)" ]; then
106106
exit 1
107107
fi
108108

109-
DOWNLOAD_URL=$(curl -s ${RELEASE_URL} | grep "browser_download_url.*docker-linux-amd64" | cut -d : -f 2,3)
109+
DOWNLOAD_URL=${DOWNLOAD_URL:-$(curl -s ${RELEASE_URL} | grep "browser_download_url.*docker-linux-amd64.tar.gz" | cut -d : -f 2,3)}
110110

111-
# Check if the ACI CLI is already installed
111+
# Check if the Compose CLI is already installed
112112
if [ $(is_new_cli "docker") -eq 1 ]; then
113113
if [ $(is_new_cli "/usr/local/bin/docker") -eq 1 ]; then
114-
echo "You already have the Docker ACI Integration CLI installed, overriding with latest version"
114+
echo "You already have the Docker Compose CLI installed, overriding with latest version"
115115
download_dir=$($sh_c 'mktemp -d')
116-
$sh_c "${download_cmd} ${download_dir}/docker-aci ${DOWNLOAD_URL}"
117-
$sudo_sh_c "install -m 775 ${download_dir}/docker-aci /usr/local/bin/docker"
116+
$sh_c "${download_cmd} ${download_dir}/docker-compose-cli.tar.gz ${DOWNLOAD_URL}"
117+
$sh_c "tar xzf ${download_dir}/docker-compose-cli.tar.gz -C ${download_dir} --strip-components 1"
118+
$sudo_sh_c "install -m 775 ${download_dir}/docker /usr/local/bin/docker"
118119
exit 0
119120
fi
120-
echo "You already have the Docker ACI Integration CLI installed, in a different location."
121+
echo "You already have the Docker Compose CLI installed, in a different location."
121122
exit 1
122123
fi
123124

@@ -169,7 +170,8 @@ echo "Downloading CLI..."
169170

170171
# Download CLI to temporary directory
171172
download_dir=$($sh_c 'mktemp -d')
172-
$sh_c "${download_cmd} ${download_dir}/docker-aci ${DOWNLOAD_URL}"
173+
$sh_c "${download_cmd} ${download_dir}/docker-compose-cli.tar.gz ${DOWNLOAD_URL}"
174+
$sh_c "tar xzf ${download_dir}/docker-compose-cli.tar.gz -C ${download_dir} --strip-components 1"
173175

174176
echo "Downloaded CLI!"
175177
echo "Installing CLI..."
@@ -178,7 +180,7 @@ echo "Installing CLI..."
178180
$sudo_sh_c "ln -s ${existing_cli_path} ${link_path}"
179181

180182
# Install downloaded CLI
181-
$sudo_sh_c "install -m 775 ${download_dir}/docker-aci /usr/local/bin/docker"
183+
$sudo_sh_c "install -m 775 ${download_dir}/docker-linux-amd64 /usr/local/bin/docker"
182184

183185
# Clear cache
184186
cleared_cache=1
@@ -196,12 +198,12 @@ if [ -n "$DRY_RUN" ]; then
196198
fi
197199

198200
if [ -n "$cleared_cache" ]; then
199-
# Check ACI CLI is working
201+
# Check Compose CLI is working
200202
if [ $(is_new_cli "docker") -eq 0 ]; then
201-
echo "Error: Docker ACI Integration CLI installation error"
203+
echo "Error: Docker Compose CLI installation error"
202204
exit 1
203205
fi
204206
echo "Done!"
205207
else
206-
echo "Please log out and in again to use the Docker ACI integration CLI"
208+
echo "Please log out and in again to use the Docker Compose CLI"
207209
fi

scripts/install/test.Dockerfile

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2020 Docker Compose CLI authors
2+
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Distro options: ubuntu, centos
16+
ARG DISTRO=ubuntu
17+
18+
FROM ubuntu:20.04 AS base-ubuntu
19+
RUN apt-get update && apt-get install -y \
20+
curl
21+
RUN curl https://get.docker.com | sh
22+
23+
FROM centos:7 AS base-centos
24+
RUN curl https://get.docker.com | sh
25+
26+
FROM base-${DISTRO} AS install
27+
COPY install_linux.sh /scripts/install_linux.sh
28+
RUN chmod +x /scripts/install_linux.sh
29+
ARG DOWNLOAD_URL=
30+
RUN DOWNLOAD_URL=${DOWNLOAD_URL} /scripts/install_linux.sh
31+
RUN docker version | grep Cloud
32+
33+
FROM install AS upgrade
34+
RUN DOWNLOAD_URL=${DOWNLOAD_URL} /scripts/install_linux.sh
35+
RUN docker version | grep Cloud
36+
37+
# To run this test locally, start an HTTP server that serves the dist/ folder
38+
# then run a docker build passing the DOWNLOAD_URL as a build arg:
39+
# $ cd dist/ && python3 -m http.server &
40+
# $ docker build -f test.Dockerfile --build-arg DOWNLOAD_URL=http://192.168.0.22:8000/docker-linux-amd64.tar.gz .
41+
#
42+
# You can specify centos or ubuntu as distros using the DISTRO build arg.

0 commit comments

Comments
 (0)