From 737f5d9eaffb53786a4edb29f3676c8bdafd49d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl?= <15849319+abcdan@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:16:19 +0200 Subject: [PATCH] docker support --- Dockerfile | 8 ++++++++ docker-compose.yml | 13 +++++++++++++ index.js | 2 +- src/app.js | 0 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml delete mode 100644 src/app.js diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dfcbe86 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM node:20 +WORKDIR /usr/src/app +COPY package*.json ./ +RUN npm install +COPY . . +EXPOSE 3000 + +CMD ["node", "index.js"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d75f7f9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +services: + app: + container_name: filehost + build: . + ports: + - "${PORT}:${PORT}" + volumes: + - .:/usr/src/app + - ./uploads:/usr/src/app/uploads + env_file: + - .env + environment: + NODE_ENV: development diff --git a/index.js b/index.js index afcf9f9..ed8f616 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const ejs = require("ejs"); const fileRoutes = require("./routes/file.routes"); const app = express(); -const port = process.env.PORT || 3000; +const port = 3000; const apiKeys = process.env.API_KEYS.split(","); const allowPublicUploads = process.env.ALLOW_PUBLIC_UPLOADS === "true"; const hosterEmail = process.env.HOSTER_EMAIL; diff --git a/src/app.js b/src/app.js deleted file mode 100644 index e69de29..0000000