Skip to content

Commit

Permalink
create temporary directory for scratch image (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenghaoz committed Feb 19, 2023
1 parent 554c2b2 commit 5e9f677
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 20 deletions.
3 changes: 0 additions & 3 deletions cmd/gorse-in-one/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse && \
go get -v -t -d ./...

RUN cd gorse/cmd/gorse-in-one && \
CGO_ENABLED=0 go build -ldflags=" \
-X 'github.com/zhenghaoz/gorse/cmd/version.Version=$(git describe --tags $(git rev-parse HEAD))' \
Expand Down
2 changes: 0 additions & 2 deletions cmd/gorse-in-one/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse

ENV CGO_ENABLED 0

RUN cd gorse/cmd/gorse-in-one; \
Expand Down
3 changes: 0 additions & 3 deletions cmd/gorse-master/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse && \
go get -v -t -d ./...

RUN cd gorse/cmd/gorse-master && \
CGO_ENABLED=0 go build -ldflags=" \
-X 'github.com/zhenghaoz/gorse/cmd/version.Version=$(git describe --tags $(git rev-parse HEAD))' \
Expand Down
2 changes: 0 additions & 2 deletions cmd/gorse-master/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse

ENV CGO_ENABLED 0

RUN cd gorse/cmd/gorse-master; \
Expand Down
3 changes: 0 additions & 3 deletions cmd/gorse-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse && \
go get -v -t -d ./...

RUN cd gorse/cmd/gorse-server && \
CGO_ENABLED=0 go build -ldflags=" \
-X 'github.com/zhenghaoz/gorse/cmd/version.Version=$(git describe --tags $(git rev-parse HEAD))' \
Expand Down
2 changes: 0 additions & 2 deletions cmd/gorse-server/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse

ENV CGO_ENABLED 0

RUN cd gorse/cmd/gorse-server; \
Expand Down
3 changes: 0 additions & 3 deletions cmd/gorse-worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse && \
go get -v -t -d ./...

RUN cd gorse/cmd/gorse-worker && \
CGO_ENABLED=0 go build -ldflags=" \
-X 'github.com/zhenghaoz/gorse/cmd/version.Version=$(git describe --tags $(git rev-parse HEAD))' \
Expand Down
2 changes: 0 additions & 2 deletions cmd/gorse-worker/Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ FROM golang:1.20

COPY . gorse

RUN cd gorse

ENV CGO_ENABLED 0

RUN cd gorse/cmd/gorse-worker; \
Expand Down
6 changes: 6 additions & 0 deletions master/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ func init() {
log.Logger().Fatal("failed to load statik files", zap.Error(err))
}
staticFileServer = http.FileServer(&SinglePageAppFileSystem{staticFileSystem})

// Create temporary directory if not exist
tempDir := os.TempDir()
if err = os.MkdirAll(tempDir, 1777); err != nil {
log.Logger().Fatal("failed to create temporary directory", zap.String("directory", tempDir), zap.Error(err))
}
}

// Taken from https://github.com/mytrile/nocache
Expand Down

0 comments on commit 5e9f677

Please sign in to comment.