From 5e4cae659ea0426e8ec3b24e0579e78771c9cb39 Mon Sep 17 00:00:00 2001 From: 2vb <2vb@protonmail.com> Date: Wed, 29 May 2024 00:08:16 -0700 Subject: [PATCH] Update --- .dockerignore | 1 + Dockerfile | 14 +++++++++----- {config => data}/assets.snow.json | 0 {config => data}/progression.book.snow.json | 0 {config => data}/progression.levels.snow.json | 0 {config => data}/season.snow.json | 0 {config => data}/variants.snow.json | 0 handlers/storage.go | 2 +- 8 files changed, 11 insertions(+), 6 deletions(-) rename {config => data}/assets.snow.json (100%) rename {config => data}/progression.book.snow.json (100%) rename {config => data}/progression.levels.snow.json (100%) rename {config => data}/season.snow.json (100%) rename {config => data}/variants.snow.json (100%) diff --git a/.dockerignore b/.dockerignore index d6dada5..6e0356b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,7 @@ !/aid !/config +!/data !/discord !/fortnite !/handlers diff --git a/Dockerfile b/Dockerfile index f326641..8b50864 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,14 +16,18 @@ RUN --mount=type=bind \ FROM busybox:1.36-glibc as busybox FROM gcr.io/distroless/base AS deploy WORKDIR /app - -# Copy binaries from Busybox COPY --from=busybox /bin /bin +RUN mkdir /app/data + +# Copy snow binary and configuration files +COPY --from=builder /snow /app/snow + # Setup user -RUN adduser -D -h /app snow -RUN chown snow /app -COPY --from=builder --chown=snow --chmod=700 /snow /app/snow +RUN adduser -D -h /app snow && \ + chown -R snow:snow /app + +USER snow EXPOSE 3000 ENTRYPOINT ["/app/snow"] \ No newline at end of file diff --git a/config/assets.snow.json b/data/assets.snow.json similarity index 100% rename from config/assets.snow.json rename to data/assets.snow.json diff --git a/config/progression.book.snow.json b/data/progression.book.snow.json similarity index 100% rename from config/progression.book.snow.json rename to data/progression.book.snow.json diff --git a/config/progression.levels.snow.json b/data/progression.levels.snow.json similarity index 100% rename from config/progression.levels.snow.json rename to data/progression.levels.snow.json diff --git a/config/season.snow.json b/data/season.snow.json similarity index 100% rename from config/season.snow.json rename to data/season.snow.json diff --git a/config/variants.snow.json b/data/variants.snow.json similarity index 100% rename from config/variants.snow.json rename to data/variants.snow.json diff --git a/handlers/storage.go b/handlers/storage.go index 17d89ea..ae30db4 100644 --- a/handlers/storage.go +++ b/handlers/storage.go @@ -77,7 +77,7 @@ func GetCloudStorageConfig(c *fiber.Ctx) error { func GetAssets(c *fiber.Ctx) error { fileName := c.Params("fileName") - path := filepath.Join("./data/files", fileName) + path := filepath.Join("./data/", fileName) _, err := os.Stat(path) if err != nil { if os.IsNotExist(err) {