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

Support static files/interpreted language containers #477

Closed
dgageot opened this issue Apr 26, 2018 · 7 comments
Closed

Support static files/interpreted language containers #477

dgageot opened this issue Apr 26, 2018 · 7 comments
Assignees
Labels
area/build kind/feature-request priority/p0 Highest priority. We are actively looking at delivering it.

Comments

@dgageot
Copy link
Contributor

dgageot commented Apr 26, 2018

Containers that serve static resources such as html, css or javascript shouldn't be built each time there's a change. It's too painful for the users.

With Docker for Desktop and docker-compose, I’d just bind mount the sources and that would be it. No rebuild involved and Live Reload could be setup to smooth the developer experience even more.
What we could do in Skaffold, un dev mode, is let the user bind mount the sources into the container running on the local Kubernetes. That’s not trivial because:

  • The user would have to know what they are doing.
  • Skaffold should at least make it possible to disable rebuild on some artifacts.
  • The bind mounting should be configured in the skaffold.yaml and injected into the kubectl manifests (do we know how to do that?)
  • Or we should support deploying a different list of manifests in dev mode and in run mode: one with the bind mounting (dev) and one without it (run).

Once we have that, we can also think about Live Reload.

@dgageot
Copy link
Contributor Author

dgageot commented May 25, 2018

I've run some tests on platforms that support sharing files with the host: Docker for Desktop and minikube.

Let's say I'm developing a static website that runs with nginx. My original k8s manifest is:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: web
        image: nginx

We could have some kind of configuration at the artifact level in the skaffold.yaml:

apiVersion: skaffold/v1alpha2
kind: Config
build:
  artifacts:
  - imageName: gcr.io/k8s-skaffold/skaffold-example
     watchChanges: false
     mount: ./html:/usr/share/nginx/html
deploy:
  kubectl:
    manifests:
      - k8s-*

On Docker for Desktop, Skaffold could then patch the yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: web
        image: nginx
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: html
      volumes:
      - name: html
        hostPath:
          path: /Users/dgageot/[...]/html

On minikube, Skaffold could patch a different way:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: web
        image: nginx
        volumeMounts:
        - mountPath: /usr/share/nginx/html
          name: html
      volumes:
      - name: html
        hostPath:
          path: /skaffold/mount1

and make sure this command runs: minikube mount /Users/dgageot/[...]/html:/skaffold/mount1

@dgageot
Copy link
Contributor Author

dgageot commented May 28, 2018

@r2d4 @dlorenc @viglesiasce Do you think I should try and implement something along those lines?

@dgageot dgageot changed the title Support containers that don't need rebuilding on each change Support static files/interpreted language containers May 28, 2018
@jonjohnsonjr
Copy link
Contributor

Could you use the same heuristic as in #565 to skip building these?

@bhack
Copy link

bhack commented Jun 19, 2018

What do you think of the ksync approach?

@dgageot dgageot self-assigned this Jun 25, 2018
@richardscarrott
Copy link

@dgageot this feature would make using Skaffold for containers running TypeScript or Babel on NodeJS a great option, I wondered whether you’ve been able to make any progress on this at all?

@r2d4 r2d4 added the priority/p2 May take a couple of releases label Jul 7, 2018
@bhack bhack mentioned this issue Aug 21, 2018
@balopat balopat added priority/p0 Highest priority. We are actively looking at delivering it. and removed priority/p2 May take a couple of releases labels Sep 8, 2018
@r2d4 r2d4 assigned r2d4 and unassigned dgageot and nkubala Sep 19, 2018
@r2d4
Copy link
Contributor

r2d4 commented Sep 19, 2018

Removing @dgageot and @nkubala since I have a prototype of this that I'm planning to add

@balopat
Copy link
Contributor

balopat commented Oct 8, 2018

closing this as #1039 fixed it.

@balopat balopat closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build kind/feature-request priority/p0 Highest priority. We are actively looking at delivering it.
Projects
None yet
Development

No branches or pull requests

7 participants