Skip to content

Commit

Permalink
Updated Tiltfile based with docker_build_with_restart
Browse files Browse the repository at this point in the history
  • Loading branch information
networkop committed Jul 26, 2020
1 parent d3ca477 commit c8f6d3a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 36 deletions.
28 changes: 0 additions & 28 deletions DockerfileTilt

This file was deleted.

21 changes: 13 additions & 8 deletions Tiltfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
load('ext://restart_process', 'docker_build_with_restart')

IMG = 'localhost:5000/coredns'

def local_build():
local("CGO_ENABLED=0 go build cmd/coredns.go")
def binary():
return "CGO_ENABLED=0 GOOS=linux GOATCH=amd64 GO111MODULE=on go build cmd/coredns.go"

local_resource('recompile', binary(), deps=['cmd', 'gateway.go', 'kubernetes.go', 'setup.go'])

local_build()
docker_build('localhost:5000/coredns', '.', dockerfile='./DockerfileTilt')
docker_build_with_restart(IMG, '.',
dockerfile='tilt.Dockerfile',
entrypoint=['/coredns'],
only=['./coredns'],
live_update=[
sync('./coredns', '/coredns'),
]
)


k8s_kind("kind")
Expand All @@ -18,7 +27,3 @@ k8s_yaml('./test/ingress.yaml')

# Metallb
k8s_yaml('./test/metallb.yaml')

watch_file("./gateway.go")
watch_file("./kubernetes.go")
watch_file("./cmd/*.go")
1 change: 1 addition & 0 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func init() {
}

func setup(c *caddy.Controller) error {

gw, err := parse(c)
if err != nil {
return plugin.Error(thisPlugin, err)
Expand Down
12 changes: 12 additions & 0 deletions tilt.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM debian:stable-slim

RUN apt-get update && apt-get -uy upgrade
RUN apt-get -y install ca-certificates && update-ca-certificates

FROM golang:alpine

COPY --from=0 /etc/ssl/certs /etc/ssl/certs
COPY coredns /

EXPOSE 53 53/udp
CMD ["/coredns"]

0 comments on commit c8f6d3a

Please sign in to comment.