Fix cache directory err check+dockerfile

This commit is contained in:
Quentin 2021-11-20 16:05:58 +01:00
parent a171e84189
commit 224cb5e217
2 changed files with 10 additions and 3 deletions

View file

@ -1,13 +1,17 @@
FROM golang:1.17.0-alpine3.14 as builder FROM golang:1.17.0-alpine3.14 as builder
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates
WORKDIR /opt WORKDIR /opt
COPY . /opt/ COPY . /opt/
RUN ls /opt/
RUN go build . RUN go build .
#-----------#
FROM scratch FROM scratch
WORKDIR /
COPY --from=builder /opt/bagage / COPY --from=builder /opt/bagage /
COPY --chown=1000:1000 --from=builder /mnt /s3_cache
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
USER 1000:1000 USER 1000:1000
ENTRYPOINT ["/bagage"] ENTRYPOINT ["/bagage"]

View file

@ -22,14 +22,17 @@ func main() {
log.Println(config) log.Println(config)
// Some init // Some init
os.MkdirAll(config.S3Cache, 0755) err := os.MkdirAll(config.S3Cache, 0755)
if err != nil {
log.Fatalf("init failed: mkdir s3 cache failed: ", err)
}
// Launch our submodules // Launch our submodules
done := make(chan error) done := make(chan error)
go httpServer(config, done) go httpServer(config, done)
go sshServer(config, done) go sshServer(config, done)
err := <-done err = <-done
if err != nil { if err != nil {
log.Fatalf("A component failed: %v", err) log.Fatalf("A component failed: %v", err)
} }