From 8672207a2cecbe5d66240dfc42422cb6305320b5 Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Fri, 7 May 2021 22:15:50 +0800 Subject: [PATCH] Fix Docker --- .dockerignore | 2 ++ Dockerfile | 18 +++++++++--------- Dockerfile.env | 18 +++++------------- Dockerfile.pwn | 19 ------------------- index.js | 2 +- 5 files changed, 17 insertions(+), 42 deletions(-) create mode 100644 .dockerignore delete mode 100644 Dockerfile.pwn diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a5393d3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +Dockerfile* diff --git a/Dockerfile b/Dockerfile index d522c47..103b12e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ -FROM node:9-stretch +FROM node:16-buster RUN apt-get update \ - && apt-get install -y build-essential zip unzip \ - && apt-get clean && rm -rf /var/lib/apt/lists/* + && apt-get install -y \ + build-essential zip unzip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* -COPY . /src - -RUN cd /src \ - && yarn install \ - && yarn cache clean +COPY . /usr/local/share/file-manager +RUN cd /usr/local/share/file-manager \ + && npm install . VOLUME /data WORKDIR /data -CMD ["node", "/src/index.js"] +CMD ["node", "/usr/local/share/file-manager/index.js"] diff --git a/Dockerfile.env b/Dockerfile.env index e7a38ce..3974052 100644 --- a/Dockerfile.env +++ b/Dockerfile.env @@ -1,19 +1,11 @@ -FROM registry.makerforce.io/ambrose/env +FROM serverwentdown/env:alpine-node -USER root - -RUN apk add --no-cache \ - build-base \ - python2 - -COPY . /usr/local/fm - -RUN cd /usr/local/fm \ - && /home/ambrose/.local/bin/yarn install \ - && /home/ambrose/.local/bin/yarn cache clean +COPY . /usr/local/share/file-manager +RUN cd /usr/local/share/file-manager \ + && sudo npm install . USER ambrose ENV SHELL="zsh -l" -CMD ["node", "/usr/local/fm/index.js"] +CMD ["node", "/usr/local/share/file-manager/index.js"] diff --git a/Dockerfile.pwn b/Dockerfile.pwn deleted file mode 100644 index e1d7de4..0000000 --- a/Dockerfile.pwn +++ /dev/null @@ -1,19 +0,0 @@ -FROM registry.makerforce.io/ambrose/pwn - -USER root - -RUN apk add --no-cache \ - build-base \ - python2 - -COPY . /usr/local/fm - -RUN cd /usr/local/fm \ - && /home/ambrose/.local/bin/yarn install \ - && /home/ambrose/.local/bin/yarn cache clean - -USER ambrose - -ENV SHELL="zsh -l" - -CMD ["node", "/usr/local/fm/index.js"] diff --git a/index.js b/index.js index b0e6bb2..753d5f9 100755 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ app.engine("handlebars", hbs({ helpers: { either: (a, b, options) => { if (a || b) { - return options.fn(); + return options.fn(this); } }, filesize: filesize,