summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-01 20:36:02 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-01 20:36:02 +1000
commit22a47a4a8569c24c861c685fa61485f739f79093 (patch)
tree7bc82ab3edc1c72e34b064d31e47bcc4e0a7b821
parentAdd config `security_twoFactor_generateBackupCodes` to control backup code ge... (diff)
parentBump file-type from 16.5.3 to 16.5.4 in /bundle (#802) (diff)
downloadserver-22a47a4a8569c24c861c685fa61485f739f79093.tar.xz
Merge branch 'master' into 2fa
-rw-r--r--.docker/env1
-rw-r--r--.dockerignore2
-rw-r--r--Dockerfile32
-rw-r--r--bundle/package-lock.json20
-rw-r--r--bundle/package.json2
-rw-r--r--cdn/package-lock.json18
-rw-r--r--cdn/package.json2
-rw-r--r--docker-compose.cfg.yml6
-rw-r--r--docker-compose.yml28
9 files changed, 38 insertions, 73 deletions
diff --git a/.docker/env b/.docker/env
deleted file mode 100644
index 595b7ba2..00000000
--- a/.docker/env
+++ /dev/null
@@ -1 +0,0 @@
-MONGO_URL=mongodb://db:27017/fosscord?readPreference=secondaryPreferred
diff --git a/.dockerignore b/.dockerignore
deleted file mode 100644
index 7ee311a4..00000000
--- a/.dockerignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules/
-db/
diff --git a/Dockerfile b/Dockerfile
index 3c8a0b31..64130e51 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,8 +1,6 @@
 FROM node:alpine
 
 # env vars
-ENV WORK_DIR="/srv/fosscord-server"
-ENV DEV_MODE=0
 ENV HTTP_PORT=3001
 ENV WS_PORT=3002
 ENV CDN_PORT=3003
@@ -13,28 +11,12 @@ ENV ADMIN_PORT=3005
 EXPOSE ${HTTP_PORT}/tcp ${WS_PORT}/tcp ${CDN_PORT}/tcp ${RTC_PORT}/tcp ${ADMIN_PORT}/tcp
 
 # install required apps
-RUN apk add --no-cache --update git python2 py-pip make build-base
+RUN apk add --no-cache --update git python3 py-pip make build-base
+RUN ln -s /usr/bin/python3 /usr/bin/python
 
-# optionl: packages for debugging/development
-RUN apk add --no-cache sqlite
+# Run as non-root user
+# RUN adduser -D fosscord
+# USER fosscord
 
-# download fosscord-server
-WORKDIR $WORK_DIR/src
-RUN git clone https://github.com/fosscord/fosscord-server.git .
-
-# setup and run
-WORKDIR $WORK_DIR/src/bundle
-RUN npm run setup
-RUN npm install @yukikaze-bot/erlpack
-# RUN npm install mysql --save
-
-# create update script
-RUN printf '#!/bin/sh\n\ngit -C $WORK_DIR/src/ checkout master\ngit -C $WORK_DIR/src/ reset --hard HEAD\ngit -C $WORK_DIR/src/ pull\ncd $WORK_DIR/src/bundle/\nnpm run setup\n' > $WORK_DIR/update.sh
-RUN chmod +x $WORK_DIR/update.sh
-
-# configure entrypoint file
-RUN printf '#!/bin/sh\n\nDEV_MODE=${DEV_MODE:-0}\n\nif [ "$DEV_MODE" -eq 1 ]; then\n    tail -f /dev/null\nelse\n    cd $WORK_DIR/src/bundle/\n    npm run start:bundle\nfi\n' > $WORK_DIR/entrypoint.sh
-RUN chmod +x $WORK_DIR/entrypoint.sh
-
-WORKDIR $WORK_DIR
-ENTRYPOINT ["./entrypoint.sh"]
+WORKDIR /srv/fosscord-server/bundle
+ENTRYPOINT ["npm", "run", "start:bundle"]
\ No newline at end of file
diff --git a/bundle/package-lock.json b/bundle/package-lock.json
index 6fbd6978..f94e8d26 100644
--- a/bundle/package-lock.json
+++ b/bundle/package-lock.json
@@ -7,7 +7,7 @@
 		"": {
 			"name": "@fosscord/server",
 			"version": "1.0.0",
-			"license": "AGPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"@aws-sdk/client-s3": "^3.36.1",
 				"@aws-sdk/node-http-handler": "^3.36.0",
@@ -31,7 +31,7 @@
 				"exif-be-gone": "^1.2.0",
 				"express": "^4.17.1",
 				"express-async-errors": "^3.1.1",
-				"file-type": "^16.5.0",
+				"file-type": "^16.5.4",
 				"form-data": "^4.0.0",
 				"fs-extra": "^10.0.0",
 				"i18next": "^19.9.2",
@@ -101,7 +101,7 @@
 			"name": "@fosscord/api",
 			"version": "1.0.0",
 			"hasInstallScript": true,
-			"license": "AGPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"@babel/preset-env": "^7.15.8",
 				"@babel/preset-typescript": "^7.15.0",
@@ -164,7 +164,7 @@
 		"../cdn": {
 			"name": "@fosscord/cdn",
 			"version": "1.0.0",
-			"license": "AGPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"@aws-sdk/client-s3": "^3.36.1",
 				"@aws-sdk/node-http-handler": "^3.36.0",
@@ -208,7 +208,7 @@
 			"name": "@fosscord/gateway",
 			"version": "1.0.0",
 			"hasInstallScript": true,
-			"license": "AGPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"@fosscord/util": "file:../util",
 				"amqplib": "^0.8.0",
@@ -5407,8 +5407,9 @@
 			}
 		},
 		"node_modules/file-type": {
-			"version": "16.5.3",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"dependencies": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
@@ -15117,8 +15118,9 @@
 			"integrity": "sha512-WOn21V8AhyE1QqVfPIVxe3tupJacq1xGkPTB4iagT6o+P2cAgEOOwIxMftr4+ZCTI6d551ij9j61DFr0nsP2uQ=="
 		},
 		"file-type": {
-			"version": "16.5.3",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"requires": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
diff --git a/bundle/package.json b/bundle/package.json
index 86e300e1..311fab18 100644
--- a/bundle/package.json
+++ b/bundle/package.json
@@ -79,7 +79,7 @@
 		"exif-be-gone": "^1.2.0",
 		"express": "^4.17.1",
 		"express-async-errors": "^3.1.1",
-		"file-type": "^16.5.0",
+		"file-type": "^16.5.4",
 		"form-data": "^4.0.0",
 		"fs-extra": "^10.0.0",
 		"i18next": "^19.9.2",
diff --git a/cdn/package-lock.json b/cdn/package-lock.json
index e6e9bb1a..62c2cdc8 100644
--- a/cdn/package-lock.json
+++ b/cdn/package-lock.json
@@ -7,7 +7,7 @@
 		"": {
 			"name": "@fosscord/cdn",
 			"version": "1.0.0",
-			"license": "GPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"@aws-sdk/client-s3": "^3.36.1",
 				"@aws-sdk/node-http-handler": "^3.36.0",
@@ -18,7 +18,7 @@
 				"exif-be-gone": "^1.2.0",
 				"express": "^4.17.1",
 				"express-async-errors": "^3.1.1",
-				"file-type": "^16.5.0",
+				"file-type": "^16.5.4",
 				"form-data": "^4.0.0",
 				"fs-extra": "^10.0.0",
 				"image-size": "^1.0.0",
@@ -51,7 +51,7 @@
 			"name": "@fosscord/util",
 			"version": "1.0.0",
 			"hasInstallScript": true,
-			"license": "GPLV3",
+			"license": "AGPL-3.0-only",
 			"dependencies": {
 				"amqplib": "^0.8.0",
 				"form-data": "^4.0.0",
@@ -3865,9 +3865,9 @@
 			}
 		},
 		"node_modules/file-type": {
-			"version": "16.5.3",
-			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"dependencies": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
@@ -10885,9 +10885,9 @@
 			}
 		},
 		"file-type": {
-			"version": "16.5.3",
-			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.3.tgz",
-			"integrity": "sha512-uVsl7iFhHSOY4bEONLlTK47iAHtNsFHWP5YE4xJfZ4rnX7S1Q3wce09XgqSC7E/xh8Ncv/be1lNoyprlUH/x6A==",
+			"version": "16.5.4",
+			"resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz",
+			"integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==",
 			"requires": {
 				"readable-web-to-node-stream": "^3.0.0",
 				"strtok3": "^6.2.4",
diff --git a/cdn/package.json b/cdn/package.json
index c63713c0..57ee89d1 100644
--- a/cdn/package.json
+++ b/cdn/package.json
@@ -44,7 +44,7 @@
 		"exif-be-gone": "^1.2.0",
 		"express": "^4.17.1",
 		"express-async-errors": "^3.1.1",
-		"file-type": "^16.5.0",
+		"file-type": "^16.5.4",
 		"form-data": "^4.0.0",
 		"fs-extra": "^10.0.0",
 		"image-size": "^1.0.0",
diff --git a/docker-compose.cfg.yml b/docker-compose.cfg.yml
new file mode 100644
index 00000000..18a7031d
--- /dev/null
+++ b/docker-compose.cfg.yml
@@ -0,0 +1,6 @@
+version: '3.9'
+
+services:
+
+  fosscord:
+    entrypoint: [ "npm", "run", "setup" ]
diff --git a/docker-compose.yml b/docker-compose.yml
index 13696f6f..4dc1ee41 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,46 +1,24 @@
-version: '3.8'
+version: '3.9'
 
 services:
+
   fosscord:
     container_name: fosscord
     image: fosscord
     restart: on-failure:5
-    # depends_on: mariadb
     build: .
     ports:
       - '3001-3005:3001-3005'
     volumes:
-      # - ./data/:${WORK_DIR:-/srv/fosscord-server}/data/
-      - data:${WORK_DIR:-/srv/fosscord-server}/
+      - ./:/srv/fosscord-server/
     environment:
-      WORK_DIR: ${WORK_DIR:-/srv/fosscord-server}
-      DEV_MODE: ${DEV_MODE:-0}
       THREADS: ${THREADS:-1}
-      DATABASE: ${DATABASE:-../../data/database.db}
-      STORAGE_LOCATION: ${STORAGE_LOCATION:-../../data/files/}
       HTTP_PORT: 3001
       WS_PORT: 3002
       CDN_PORT: 3003
       RTC_PORT: 3004
       ADMIN_PORT: 3005
 
-  # mariadb:
-  #   image: mariadb:latest
-  #   restart: on-failure:5
-  #   environment:
-  #     MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-secr3tpassw0rd}
-  #     MYSQL_DATABASE: ${MYSQL_DATABASE:-fosscord}
-  #     MYSQL_USER: ${MYSQL_USER:-fosscord}
-  #     MYSQL_PASSWORD: ${MYSQL_PASSWORD:-password1}
-  #   networks:
-  #     - default
-  #   volumes:
-  #     - mariadb:/var/lib/mysql
-
-volumes:
-  data:
-  # mariadb:
-
 networks:
   default:
     name: fosscord