aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2021-11-20 16:05:58 +0100
committerQuentin <quentin@deuxfleurs.fr>2021-11-20 16:05:58 +0100
commit224cb5e217f4e6c69cde1bb3fd26fecd6ced5f9a (patch)
tree048fb0de445238fcd7147dfafabe02b4eebae00d
parenta171e8418967f005b6943d769636eefe95f1a2ea (diff)
downloadbagage-224cb5e217f4e6c69cde1bb3fd26fecd6ced5f9a.tar.gz
bagage-224cb5e217f4e6c69cde1bb3fd26fecd6ced5f9a.zip
Fix cache directory err check+dockerfile
-rw-r--r--Dockerfile6
-rw-r--r--main.go7
2 files changed, 10 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile
index 5b059dd..f7db7ba 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,13 +1,17 @@
FROM golang:1.17.0-alpine3.14 as builder
ENV CGO_ENABLED=0 GOOS=linux GOARCH=amd64
+
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates
+
WORKDIR /opt
COPY . /opt/
-RUN ls /opt/
RUN go build .
+#-----------#
FROM scratch
+WORKDIR /
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/
USER 1000:1000
ENTRYPOINT ["/bagage"]
diff --git a/main.go b/main.go
index a76690e..5895b12 100644
--- a/main.go
+++ b/main.go
@@ -22,14 +22,17 @@ func main() {
log.Println(config)
// 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
done := make(chan error)
go httpServer(config, done)
go sshServer(config, done)
- err := <-done
+ err = <-done
if err != nil {
log.Fatalf("A component failed: %v", err)
}