Minor fixes to frontend

This commit is contained in:
frikky
2021-03-01 11:57:48 +01:00
parent 5a37acf5ba
commit f91307e0a2
6 changed files with 50 additions and 15 deletions
+4 -8
View File
@@ -2,20 +2,16 @@ FROM golang:1.16.0-buster as builder
WORKDIR /app
COPY worker.go /app/worker.go
RUN go env -w GO111MODULE=auto
RUN go get -u github.com/docker/docker/api/types
RUN go get -u github.com/docker/docker/api/types/container
RUN go get -u github.com/docker/docker/client
RUN go get -u github.com/gorilla/mux
RUN go get -u github.com/patrickmn/go-cache
COPY worker.go /app/worker.go
RUN go env -w GO111MODULE=auto && \
go get github.com/docker/docker/api/types && \
go get github.com/docker/docker/api/types/container && \
go get github.com/docker/docker/client && \
go get github.com/gorilla/mux && \
go get github.com/patrickmn/go-cache && \
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker .
FROM alpine:3.12
+32
View File
@@ -18,6 +18,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
dockerclient "github.com/docker/docker/client"
"github.com/gorilla/mux"
@@ -877,6 +878,37 @@ func deployApp(cli *dockerclient.Client, image string, identifier string, env []
hostConfig.AutoRemove = true
}
// FIXME: Add proper foldermounts here
//log.Printf("\n\nPRE FOLDERMOUNT\n\n")
//volumeBinds := []string{"/tmp/shuffle-mount:/rules"}
//volumeBinds := []string{"/tmp/shuffle-mount:/rules"}
volumeBinds := []string{}
if len(volumeBinds) > 0 {
log.Printf("[INFO] Setting up binds for container!")
hostConfig.Binds = volumeBinds
hostConfig.Mounts = []mount.Mount{}
for _, bind := range volumeBinds {
if !strings.Contains(bind, ":") || strings.Contains(bind, "..") || strings.HasPrefix(bind, "~") {
log.Printf("[WARNING] Bind %s is invalid.", bind)
continue
}
log.Printf("[INFO] Appending bind %s", bind)
bindSplit := strings.Split(bind, ":")
sourceFolder := bindSplit[0]
destinationFolder := bindSplit[0]
hostConfig.Mounts = append(hostConfig.Mounts, mount.Mount{
Type: mount.TypeBind,
Source: sourceFolder,
Target: destinationFolder,
})
}
} else {
log.Printf("[WARNING] No mounted folders")
}
// hostConfig.Binds = volumeBinds
//}
config := &container.Config{
Image: image,
Env: env,