Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watcher breaks with dockerfile using COPY --parents #9411

Open
khumps opened this issue May 3, 2024 · 0 comments
Open

watcher breaks with dockerfile using COPY --parents #9411

khumps opened this issue May 3, 2024 · 0 comments

Comments

@khumps
Copy link

khumps commented May 3, 2024

Expected behavior

A dockerfile utilizing the COPY --parents ..... instruction should properly detect a list of files that are dependencies and rebuild on change when running skaffold dev

Actual behavior

running skaffold dev builds once but does not detect any changes so it never rebuilds again (even on sequential runs of skaffold dev)

Information

Dockerfile

# syntax=docker/dockerfile:1.7-labs
FROM golang:1.20 AS build-stage

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download
COPY --parents ./vendor go.mod go.sum ./
COPY --parents ./**/*.go ./
RUN CGO_ENABLED=0 GOOS=linux go build -o /binary /app/cmd/main.go

# Deploy the application binary into a lean image
FROM gcr.io/distroless/base-debian11 AS build-release-stage

WORKDIR /

COPY --from=build-stage /binary /binary

USER nonroot:nonroot

ENTRYPOINT ["/binary"]
  • Skaffold version: v2.11.0
  • Operating system: Amazon Linux 2023
  • Installed via: skaffold curl command
  • Contents of skaffold.yaml:
# nonk8s
apiVersion: skaffold/v4beta10	# 	version of the configuration.
kind: Config
metadata:
  name: REPO_NAME
build:
  artifacts:
    - image: REGISTRY_URL/IMAGE_NAME
      context: .
      docker:
        dockerfile: cmd/Dockerfile
  local:
    useBuildkit: true
    useDockerCLI: true
deploy:
  helm:
    releases:
      - name: PACKAGE_NAME
        chartPath: helm
        setValueTemplates:
          devicectl.image: "{{.IMAGE_FULLY_QUALIFIED_REGISTRY_URL_IMAGE_NAME}}"
        createNamespace: true
profiles:
  - name: helm-debug
    patches:
        - op: add
          path: /deploy/helm/flags
          value:
            global:
              - --debug
  - name: staging
    patches:
      - op: add
        path: /deploy/helm/releases/0/valuesFiles
        value: ["helm/values-staging.yaml"]
  - name: dev
    activation:
      - command: dev
    patches:
      - op: add
        path: /deploy/helm/releases/0/valuesFiles
        value: [ "helm/values-dev.yaml" ]

Steps to reproduce the behavior

  1. skaffold dev
  2. build completes and shows watching for changes

Debug logging

There is a line after `Watching for changes

DEBU[0006] Found dependencies for dockerfile: [all go files that are one directory level down, not recursively down (ex /cmd/main.go is listed but /cmd/pkg/dependency.go is not]

If I replace

COPY --parents ./vendor go.mod go.sum ./
COPY --parents ./**/*.go ./

with

COPY . .

dependencies work just fine (but then I am bringing a lot of unnecessary files into the build context and triggering rebuilds even when code isn't changjng)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant