mirror of https://github.com/docker/compose.git
use CGO to enable fsevent on OSX
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
5b043c4d59
commit
7a42ba7eec
|
@ -27,12 +27,16 @@ ARG LICENSE_FILES=".*\(Dockerfile\|Makefile\|\.go\|\.hcl\|\.sh\)"
|
|||
# xx is a helper for cross-compilation
|
||||
FROM --platform=${BUILDPLATFORM} tonistiigi/xx:${XX_VERSION} AS xx
|
||||
|
||||
# osxcross contains the MacOSX cross toolchain for xx
|
||||
FROM crazymax/osxcross:11.3-alpine AS osxcross
|
||||
|
||||
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
|
||||
FROM ghcr.io/google/addlicense:${ADDLICENSE_VERSION} AS addlicense
|
||||
|
||||
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS base
|
||||
COPY --from=xx / /
|
||||
RUN apk add --no-cache \
|
||||
clang \
|
||||
docker \
|
||||
file \
|
||||
findutils \
|
||||
|
@ -73,10 +77,12 @@ EOT
|
|||
FROM build-base AS build
|
||||
ARG BUILD_TAGS
|
||||
ARG TARGETPLATFORM
|
||||
RUN xx-go --wrap
|
||||
RUN --mount=type=bind,target=. \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
--mount=type=cache,target=/go/pkg/mod \
|
||||
--mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk \
|
||||
xx-go --wrap && \
|
||||
if [ "$(xx-info os)" == "darwin" ]; then export CGO_ENABLED=1; fi && \
|
||||
make build GO_BUILDTAGS="$BUILD_TAGS" DESTDIR=/usr/bin && \
|
||||
xx-verify --static /usr/bin/docker-compose
|
||||
|
||||
|
|
2
Makefile
2
Makefile
|
@ -53,7 +53,7 @@ all: build
|
|||
|
||||
.PHONY: build ## Build the compose cli-plugin
|
||||
build:
|
||||
CGO_ENABLED=0 GO111MODULE=on go build -trimpath -tags "$(GO_BUILDTAGS)" -ldflags "$(GO_LDFLAGS)" -o "$(DESTDIR)/docker-compose$(BINARY_EXT)" ./cmd
|
||||
GO111MODULE=on go build -trimpath -tags "$(GO_BUILDTAGS)" -ldflags "$(GO_LDFLAGS)" -o "$(DESTDIR)/docker-compose$(BINARY_EXT)" ./cmd
|
||||
|
||||
.PHONY: binary
|
||||
binary:
|
||||
|
|
1
go.mod
1
go.mod
|
@ -59,6 +59,7 @@ require (
|
|||
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
|
||||
github.com/docker/go-metrics v0.0.1 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.2 // indirect
|
||||
github.com/fsnotify/fsevents v0.1.1
|
||||
github.com/fvbommel/sortorder v1.0.2 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -254,6 +254,8 @@ github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSw
|
|||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||
github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
|
||||
github.com/fsnotify/fsevents v0.1.1 h1:/125uxJvvoSDDBPen6yUZbil8J9ydKZnnl3TWWmvnkw=
|
||||
github.com/fsnotify/fsevents v0.1.1/go.mod h1:+d+hS27T6k5J8CRaPLKFgwKYcpS7GwW3Ule9+SC2ZRc=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
|
|
|
@ -435,7 +435,7 @@ func TestWatchNonexistentDirectory(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// for directories that were the root of an Add, we don't report creation, cf. watcher_fsevent.go
|
||||
// for directories that were the root of an Add, we don't report creation, cf. watcher_darwin.go
|
||||
f.assertEvents()
|
||||
|
||||
f.events = nil
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
|
||||
package watch
|
||||
|
||||
/**
|
||||
FIXME this implementation requires CGO
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
@ -130,7 +127,7 @@ func (d *fseventNotify) Errors() chan error {
|
|||
return d.errors
|
||||
}
|
||||
|
||||
func newFSEventWatcher(paths []string, ignore PathMatcher) (*fseventNotify, error) {
|
||||
func newWatcher(paths []string, ignore PathMatcher) (Notify, error) {
|
||||
dw := &fseventNotify{
|
||||
ignore: ignore,
|
||||
stream: &fsevents.EventStream{
|
||||
|
@ -158,4 +155,3 @@ func newFSEventWatcher(paths []string, ignore PathMatcher) (*fseventNotify, erro
|
|||
}
|
||||
|
||||
var _ Notify = &fseventNotify{}
|
||||
**/
|
|
@ -1,3 +1,6 @@
|
|||
//go:build !darwin
|
||||
// +build !darwin
|
||||
|
||||
/*
|
||||
Copyright 2020 Docker Compose CLI authors
|
||||
|
||||
|
@ -294,7 +297,7 @@ func (d *naiveNotify) add(path string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func newWatcher(paths []string, ignore PathMatcher) (*naiveNotify, error) {
|
||||
func newWatcher(paths []string, ignore PathMatcher) (Notify, error) {
|
||||
if ignore == nil {
|
||||
return nil, fmt.Errorf("newWatcher: ignore is nil")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue