mirror of
https://github.com/moby/moby.git
synced 2026-08-03 22:51:03 +00:00
use /usr/src/moby instead, and no GOPATH
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
"dockerfile": "../Dockerfile",
|
||||
"target": "devcontainer"
|
||||
},
|
||||
"workspaceFolder": "/go/src/github.com/moby/moby/v2",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/go/src/github.com/moby/moby/v2,type=bind,consistency=cached",
|
||||
"workspaceFolder": "/usr/src/moby",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=${containerWorkspaceFolder},type=bind,consistency=cached",
|
||||
|
||||
"remoteUser": "root",
|
||||
"runArgs": ["--privileged"],
|
||||
|
||||
28
.github/workflows/.windows.yml
vendored
28
.github/workflows/.windows.yml
vendored
@@ -46,13 +46,13 @@ jobs:
|
||||
BIN_OUT: ${{ github.workspace }}\out
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
working-directory: /usr/src/moby
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
path: /usr/src/moby
|
||||
-
|
||||
name: Env
|
||||
run: |
|
||||
@@ -112,9 +112,9 @@ jobs:
|
||||
name: Copy artifacts
|
||||
run: |
|
||||
New-Item -ItemType "directory" -Path "${{ env.BIN_OUT }}"
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\docker-buildx.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\docker.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\dockerd.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\docker-buildx.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\bin\gotestsum.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd-shim-runhcs-v1.exe" ${{ env.BIN_OUT }}\
|
||||
@@ -136,13 +136,13 @@ jobs:
|
||||
GOBIN: ${{ github.workspace }}\go\bin
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
working-directory: /usr/src/moby
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
path: /usr/src/moby
|
||||
-
|
||||
name: Env
|
||||
run: |
|
||||
@@ -198,14 +198,14 @@ jobs:
|
||||
name: Test
|
||||
run: |
|
||||
& docker run --name ${{ env.TEST_CTN_NAME }} -e "DOCKER_GITCOMMIT=${{ github.sha }}" `
|
||||
-v "${{ env.GOPATH }}\src\github.com\moby\moby\v2\bundles:C:\gopath\src\github.com\moby\moby\v2\bundles" `
|
||||
-v "C:\usr\src\moby\bundles:C:\usr\src\moby\bundles" `
|
||||
${{ env.TEST_IMAGE_NAME }} hack\make.ps1 -TestUnit
|
||||
-
|
||||
name: Send to Codecov
|
||||
if: inputs.send_coverage
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
|
||||
with:
|
||||
working-directory: ${{ env.GOPATH }}\src\github.com\moby\moby\v2
|
||||
working-directory: C:\usr\src\moby\
|
||||
directory: bundles
|
||||
env_vars: RUNNER_OS
|
||||
flags: unit
|
||||
@@ -216,7 +216,7 @@ jobs:
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: ${{ inputs.os }}-${{ inputs.storage }}-unit-reports
|
||||
path: ${{ env.GOPATH }}\src\github.com\moby\moby\v2\bundles\*
|
||||
path: C:\usr\src\moby\bundles\*
|
||||
retention-days: 1
|
||||
|
||||
unit-test-report:
|
||||
@@ -306,13 +306,13 @@ jobs:
|
||||
BIN_OUT: ${{ github.workspace }}\out
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
working-directory: /usr/src/moby
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
path: /usr/src/moby
|
||||
-
|
||||
name: Set up Go
|
||||
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
|
||||
@@ -511,7 +511,7 @@ jobs:
|
||||
if: inputs.send_coverage
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v6.0.2
|
||||
with:
|
||||
working-directory: ${{ env.GOPATH }}\src\github.com\moby\moby\v2
|
||||
working-directory: C:\usr\src\moby\
|
||||
directory: bundles
|
||||
env_vars: RUNNER_OS
|
||||
flags: integration,${{ matrix.runtime }}
|
||||
@@ -555,7 +555,7 @@ jobs:
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: ${{ inputs.os }}-${{ inputs.storage }}-integration-reports-${{ matrix.runtime }}-${{ env.TESTREPORTS_NAME }}
|
||||
path: ${{ env.GOPATH }}\src\github.com\moby\moby\v2\bundles\*
|
||||
path: C:\usr\src\moby\bundles\*
|
||||
retention-days: 1
|
||||
|
||||
integration-test-report:
|
||||
|
||||
8
.github/workflows/buildkit.yml
vendored
8
.github/workflows/buildkit.yml
vendored
@@ -180,12 +180,12 @@ jobs:
|
||||
TEST_CTN_NAME: moby
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
working-directory: /usr/src/moby
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
||||
with:
|
||||
path: ${{ env.GOPATH }}/src/github.com/moby/moby/v2
|
||||
path: /usr/src/moby
|
||||
|
||||
- name: Env
|
||||
run: |
|
||||
@@ -252,8 +252,8 @@ jobs:
|
||||
- name: Copy artifacts
|
||||
run: |
|
||||
New-Item -ItemType "directory" -Path "${{ env.BIN_OUT }}"
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\docker.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\usr\src\moby\bundles\dockerd.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\gopath\bin\gotestsum.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd.exe" ${{ env.BIN_OUT }}\
|
||||
docker cp "${{ env.TEST_CTN_NAME }}`:c`:\containerd\bin\containerd-shim-runhcs-v1.exe" ${{ env.BIN_OUT }}\
|
||||
|
||||
@@ -440,7 +440,7 @@ ENV PATH=/usr/local/cli:$PATH
|
||||
ENV TEST_CLIENT_BINARY=/usr/local/cli-integration/docker
|
||||
ENV CONTAINERD_ADDRESS=/run/docker/containerd/containerd.sock
|
||||
ENV CONTAINERD_NAMESPACE=moby
|
||||
WORKDIR /go/src/github.com/moby/moby/v2
|
||||
WORKDIR /usr/src/moby
|
||||
VOLUME /var/lib/docker
|
||||
VOLUME /home/unprivilegeduser/.local/share/docker
|
||||
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
||||
@@ -470,13 +470,13 @@ RUN useradd --create-home --gid docker unprivilegeduser \
|
||||
&& mkdir -p /home/unprivilegeduser/.local/share/docker \
|
||||
&& chown -R unprivilegeduser /home/unprivilegeduser
|
||||
# Let us use a .bashrc file
|
||||
RUN ln -sfv /go/src/github.com/moby/moby/v2/.bashrc ~/.bashrc
|
||||
RUN ln -sfv /usr/src/moby/.bashrc ~/.bashrc
|
||||
# Activate bash completion
|
||||
RUN echo "source /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc
|
||||
RUN ldconfig
|
||||
# Set dev environment as safe git directory to prevent "dubious ownership" errors
|
||||
# when bind-mounting the source into the dev-container. See https://github.com/moby/moby/pull/44930
|
||||
RUN git config --global --add safe.directory $GOPATH/src/github.com/moby/moby/v2
|
||||
RUN git config --global --add safe.directory /usr/src/moby
|
||||
# This should only install packages that are specifically needed for the dev environment and nothing else
|
||||
# Do you really need to add another package here? Can it be done in a different build stage?
|
||||
RUN --mount=type=cache,sharing=locked,id=moby-dev-aptlib,target=/var/lib/apt \
|
||||
@@ -526,7 +526,7 @@ COPY --link --from=dockercli-integration /build/ /usr/local/cli-integration
|
||||
|
||||
FROM base AS build
|
||||
COPY --from=gowinres /build/ /usr/local/bin/
|
||||
WORKDIR /go/src/github.com/moby/moby/v2
|
||||
WORKDIR /usr/src/moby
|
||||
ENV CGO_ENABLED=1
|
||||
RUN --mount=type=cache,sharing=locked,id=moby-build-aptlib,target=/var/lib/apt \
|
||||
--mount=type=cache,sharing=locked,id=moby-build-aptcache,target=/var/cache/apt \
|
||||
|
||||
@@ -57,5 +57,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ENV PATH=/usr/local/cli:$PATH
|
||||
|
||||
ENV AUTO_GOPATH 1
|
||||
WORKDIR /usr/src/docker
|
||||
COPY . /usr/src/docker
|
||||
WORKDIR /usr/src/moby
|
||||
COPY . /usr/src/moby
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
#
|
||||
# 1. Clone the sources from github.com:
|
||||
#
|
||||
# >> git clone https://github.com/moby/moby.git C:\gopath\src\github.com\moby\moby\v2
|
||||
# >> Cloning into 'C:\gopath\src\github.com\moby\moby\v2'...
|
||||
# >> git clone https://github.com/moby/moby.git C:\usr\src\moby
|
||||
# >> Cloning into 'C:\usr\src\moby'...
|
||||
# >> remote: Counting objects: 186216, done.
|
||||
# >> remote: Compressing objects: 100% (21/21), done.
|
||||
# >> remote: Total 186216 (delta 5), reused 0 (delta 0), pack-reused 186195
|
||||
@@ -59,7 +59,7 @@
|
||||
#
|
||||
# 2. Change directory to the cloned docker sources:
|
||||
#
|
||||
# >> cd C:\gopath\src\github.com\moby\moby\v2
|
||||
# >> cd C:\usr\src\moby
|
||||
#
|
||||
#
|
||||
# 3. Build a docker image with the components required to build the docker binaries from source
|
||||
@@ -79,8 +79,8 @@
|
||||
# 5. Copy the binaries out of the container, replacing HostPath with an appropriate destination
|
||||
# folder on the host system where you want the binaries to be located.
|
||||
#
|
||||
# >> docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe C:\HostPath\docker.exe
|
||||
# >> docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe C:\HostPath\dockerd.exe
|
||||
# >> docker cp binaries:C:\usr\src\moby\bundles\docker.exe C:\HostPath\docker.exe
|
||||
# >> docker cp binaries:C:\usr\src\moby\bundles\dockerd.exe C:\HostPath\dockerd.exe
|
||||
#
|
||||
#
|
||||
# 6. (Optional) Remove the interim container holding the built executable binaries:
|
||||
@@ -267,7 +267,7 @@ RUN `
|
||||
Remove-Item C:\containerd.tar.gz; `
|
||||
`
|
||||
# Ensure all directories exist that we will require below....
|
||||
$srcDir = """$Env:GOPATH`\src\github.com\moby\moby\v2\bundles"""; `
|
||||
$srcDir = """C:\usr\src\moby\bundles"""; `
|
||||
Write-Host INFO: Ensuring existence of directory $srcDir...; `
|
||||
New-Item -Force -ItemType Directory -Path $srcDir | Out-Null; `
|
||||
`
|
||||
@@ -306,7 +306,7 @@ RUN `
|
||||
ENTRYPOINT ["powershell.exe"]
|
||||
|
||||
# Set the working directory to the location of the sources
|
||||
WORKDIR ${GOPATH}\src\github.com\moby\moby\v2
|
||||
WORKDIR /usr/src/moby
|
||||
|
||||
# Copy the sources into the container
|
||||
COPY . .
|
||||
|
||||
4
Makefile
4
Makefile
@@ -86,13 +86,13 @@ BIND_DIR := $(if $(BINDDIR),$(BINDDIR),$(if $(DOCKER_HOST),,.))
|
||||
|
||||
# DOCKER_MOUNT can be overridden, but use at your own risk!
|
||||
ifndef DOCKER_MOUNT
|
||||
DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(BIND_DIR):/go/src/github.com/moby/moby/v2/$(BIND_DIR)")
|
||||
DOCKER_MOUNT := $(if $(BIND_DIR),-v "$(BIND_DIR):/usr/src/moby/$(BIND_DIR)")
|
||||
DOCKER_MOUNT := $(if $(DOCKER_BINDDIR_MOUNT_OPTS),$(DOCKER_MOUNT):$(DOCKER_BINDDIR_MOUNT_OPTS),$(DOCKER_MOUNT))
|
||||
|
||||
# This allows the test suite to be able to run without worrying about the underlying fs used by the container running the daemon (e.g. aufs-on-aufs), so long as the host running the container is running a supported fs.
|
||||
# The volume will be cleaned up when the container is removed due to `--rm`.
|
||||
# Note that `BIND_DIR` will already be set to `bundles` if `DOCKER_HOST` is not set (see above BIND_DIR line), in such case this will do nothing since `DOCKER_MOUNT` will already be set.
|
||||
DOCKER_MOUNT := $(if $(DOCKER_MOUNT),$(DOCKER_MOUNT),-v /go/src/github.com/moby/moby/v2/bundles) -v "$(CURDIR)/.git:/go/src/github.com/moby/moby/v2/.git"
|
||||
DOCKER_MOUNT := $(if $(DOCKER_MOUNT),$(DOCKER_MOUNT),-v /usr/src/moby/bundles) -v "$(CURDIR)/.git:/usr/src/moby/.git"
|
||||
|
||||
DOCKER_MOUNT_CACHE := -v docker-dev-cache:/root/.cache -v docker-mod-cache:/go/pkg/mod/
|
||||
DOCKER_MOUNT_CLI := $(if $(DOCKER_CLI_PATH),-v $(shell dirname $(DOCKER_CLI_PATH)):/usr/local/cli,)
|
||||
|
||||
@@ -100,8 +100,8 @@ To build Moby, run:
|
||||
Copy out the resulting Windows Moby Engine binary to `dockerd.exe` in the
|
||||
current directory:
|
||||
|
||||
docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\docker.exe docker.exe
|
||||
docker cp binaries:C:\gopath\src\github.com\moby\moby\v2\bundles\dockerd.exe dockerd.exe
|
||||
docker cp binaries:C:\usr\src\moby\bundles\docker.exe docker.exe
|
||||
docker cp binaries:C:\usr\src\moby\bundles\dockerd.exe dockerd.exe
|
||||
|
||||
To test it, stop the system Docker daemon and start the one you just built:
|
||||
|
||||
@@ -110,7 +110,7 @@ To test it, stop the system Docker daemon and start the one you just built:
|
||||
|
||||
The other make targets work too, to run unit tests try:
|
||||
|
||||
docker run --rm docker-builder sh -c 'cd /c/gopath/src/github.com/moby/moby/v2; hack/make.sh test-unit'
|
||||
docker run --rm docker-builder sh -c 'cd /c/usr/src/moby; hack/make.sh test-unit'
|
||||
|
||||
### 6. Remove the interim binaries container
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ After=firewalld.service
|
||||
Type=oneshot
|
||||
ExecStart=/bin/true
|
||||
RemainAfterExit=true
|
||||
ExecStop=cp /var/log/firewalld /go/src/github.com/moby/moby/v2/bundles/firewalld.log
|
||||
ExecStop=cp /var/log/firewalld /usr/src/moby/bundles/firewalld.log
|
||||
|
||||
[Install]
|
||||
WantedBy=firewalld.service
|
||||
|
||||
@@ -17,7 +17,7 @@ RUN <<EOT
|
||||
wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip
|
||||
unzip protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip -d /usr/local
|
||||
EOT
|
||||
WORKDIR /go/src/github.com/moby/moby
|
||||
WORKDIR /usr/src/moby
|
||||
|
||||
FROM base AS src
|
||||
WORKDIR /out
|
||||
|
||||
@@ -5,7 +5,7 @@ ARG GOVULNCHECK_VERSION=v1.1.4
|
||||
ARG FORMAT=text
|
||||
|
||||
FROM golang:${GO_VERSION}-alpine AS base
|
||||
WORKDIR /go/src/github.com/moby/moby
|
||||
WORKDIR /usr/src/moby
|
||||
RUN apk add --no-cache jq moreutils
|
||||
ARG GOVULNCHECK_VERSION
|
||||
ADD https://github.com/golang/vuln.git?ref=${GOVULNCHECK_VERSION}&keep-git-dir=1 /go/src/golang.org/x/vuln
|
||||
|
||||
@@ -225,10 +225,9 @@ func ensureBasicPluginBin() (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
installPath := filepath.Join(os.Getenv("GOPATH"), "bin", name)
|
||||
sourcePath := filepath.Join("github.com", "moby", "moby", "v2", "internal", "testutil", "fixtures", "plugin", "basic")
|
||||
cmd := exec.Command(goBin, "build", "-o", installPath, sourcePath)
|
||||
cmd.Env = append(os.Environ(), "CGO_ENABLED=0", "GO111MODULE=off")
|
||||
installPath := filepath.Join(os.Getenv("GOBIN"), name)
|
||||
cmd := exec.Command(goBin, "build", "-buildvcs=false", "-o", installPath, "github.com/moby/moby/v2/internal/testutil/fixtures/plugin/basic")
|
||||
cmd.Env = append(os.Environ(), "CGO_ENABLED=0", "GO111MODULE=auto")
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
return "", errors.Wrapf(err, "error building basic plugin bin: %s", string(out))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user