docker support

master
qwertyforce 2023-07-06 18:10:59 +03:00
parent 46a9a4bc98
commit 6bbf108628
8 changed files with 99 additions and 3 deletions

11
.dockerignore Normal file
View File

@ -0,0 +1,11 @@
.git
__pycache__
.gitignore
Dockerfile
README.md
public
import
images_md
node_modules
_next
dist

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM node:19
# ARG USERNAME=app
# ARG USER_UID=1001
# ARG USER_GID=1001
RUN apt update && apt install -y libjpeg-turbo-progs
WORKDIR /app
COPY ./ ./
RUN rm ./src/config/config.ts && mv ./src/config/config_docker.ts ./src/config/config.ts
RUN npm install
RUN npm run bootstrap
# Create the user
# RUN groupadd --gid $USER_GID $USERNAME \
# && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
# RUN chown -R $USER_UID:$USER_GID /app
EXPOSE 80
# USER app
CMD ["npm","run","build_and_start"]

38
docker-compose.yml Normal file
View File

@ -0,0 +1,38 @@
version: "3.8"
services:
mongodb_server:
image: mongo:6.0
restart: unless-stopped
ports:
- 44096:27017
volumes:
- scenery_db:/data/db
networks:
- scenery_net
scenery:
depends_on:
- mongodb_server
build:
context: ./
network: host
volumes:
- type: bind
source: ./public
target: /app/public
restart: unless-stopped
ports:
- 7395:80
networks:
- ambience_net
- scenery_net
volumes:
scenery_db:
networks:
scenery_net:
ambience_net:
external: true

View File

@ -20,7 +20,7 @@ module.exports = {
recaptcha_site_key: "6LcqV9QUAAAAAEybBVr0FWnUnFQmOVxGoQ_Muhtb",
api_domain: "http://localhost/public_api",
domain: "http://localhost",
ipns: "ipns.scenery.cx"
ipns: "ipns.scenery.cx" //example, put your own domain here
},
distDir: '_next'
}

View File

@ -7,6 +7,7 @@
"build": "cross-env NODE_OPTIONS=--openssl-legacy-provider next build && tsc --project tsconfig.server.json",
"build_pages": "next build",
"build_server": "tsc --project tsconfig.server.json",
"build_and_start": "cross-env NODE_OPTIONS=--openssl-legacy-provider next build && tsc --project tsconfig.server.json && cross-env NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production node dist/server/index.js",
"start": "cross-env NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=production node dist/server/index.js",
"start_dev": "cross-env NODE_ENV=development node dist/server/index.js",
"import_images": "cross-env NODE_ENV=development node dist/server/bulk_ops/bulk_import_images.js",

View File

@ -1,6 +1,7 @@
import path from "path"
const server_config = {
domain: "http://127.0.0.1",
host_ip: "127.0.0.1",
domain: "http://127.0.0.1", //for redirecting
recaptcha_secret_key: "6LcqV9QUAAAAAOA18kbCEWRBhF4g4LjSTaFRVe9P",
GOOGLE_CLIENT_ID: "1006819405532-0tm9sghd6nvnpc3djf9pbrdppminbdjf.apps.googleusercontent.com",
GOOGLE_CLIENT_SECRET: "7S3KdJSNRYwkfe47dHtrJO0M",

View File

@ -0,0 +1,24 @@
import path from "path"
const server_config = {
host_ip: "0.0.0.0",
domain: "http://127.0.0.1", //for redirecting
recaptcha_secret_key: "6LcqV9QUAAAAAOA18kbCEWRBhF4g4LjSTaFRVe9P",
GOOGLE_CLIENT_ID: "1006819405532-0tm9sghd6nvnpc3djf9pbrdppminbdjf.apps.googleusercontent.com",
GOOGLE_CLIENT_SECRET: "7S3KdJSNRYwkfe47dHtrJO0M",
GOOGLE_REDIRECT_URI: "http://127.0.0.1/auth/google/callback",
GITHUB_CLIENT_ID: "d4f2879aafb5bfac8dec",
GITHUB_CLIENT_SECRET: "a2b8462d6cefb17339f4b730578db280b65e84ad",
GITHUB_REDIRECT_URI: "http://127.0.0.1/auth/github/callback",
gmail_user: "auth.test.reg.email@gmail.com",
gmail_password: "sbuLBh9rAV8XD2",
mongodb_url: "mongodb://mongodb_server/",
server_port: "80",
session_secret: "ghuieorifigyfuu9u3i45jtr73490548t7ht",
root_path: path.join(__dirname, "..", ".."),
ambience_microservice_url: "http://ambience:44444",
use_backup_file_server: false,
backup_file_server_url: "http://127.0.0.1:8787",
optimize_images: true,
import_images_bot_password: "" //if "" then deactivated
}
export default server_config

View File

@ -150,7 +150,7 @@ function main() {
reply.hijack()
})
server.listen({port:port, host:"127.0.0.1"}, function (err, address) {
server.listen({port:port, host:config.host}, function (err, address) {
if (err) {
console.error(err)
process.exit(1)