From 5b8189507b704d7ad154fcb3a15bb9a6a63f54c9 Mon Sep 17 00:00:00 2001 From: RyeBread <111273115+ryebreadgit@users.noreply.github.com> Date: Sat, 17 Jun 2023 21:57:00 -0600 Subject: [PATCH] Add Docker Compose Files & Update Dockerfile to use Alpine Linux * Update Dockerfile to use Alpine Linux * Add docker-compose files * Modify readme to add docker compose docs. * Update build context * Limit elasticsearch to 1GB memory by default * Drop http.host from docker-compose-es PR: https://github.com/Yakabuff/redarc/pull/13 --- Dockerfile | 14 ++++------- README.md | 18 ++++++++++++++ docker-compose-es.yml | 58 +++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 40 +++++++++++++++++++++++++++++ scripts/start.sh | 2 +- 5 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 docker-compose-es.yml create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 924a842..740fcc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,8 @@ -FROM ubuntu:22.04 +FROM node:16-alpine3.17 -RUN apt-get update && apt-get install -y -RUN apt-get install -y curl -RUN apt-get install -y nginx -RUN apt-get install -y python3 -RUN apt-get install -y postgresql-client -RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ - apt-get install -y nodejs +RUN apk update +# Download the runtime dependencies +RUN apk add --no-cache bash nginx python3 postgresql-client RUN mkdir -p /redarc WORKDIR /redarc @@ -20,4 +16,4 @@ RUN npm ci WORKDIR /redarc RUN chmod +x scripts/start.sh -CMD ["scripts/start.sh"] \ No newline at end of file +CMD ["/bin/bash", "scripts/start.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 633fd37..8d4ff88 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,24 @@ eg: `http://redarc.basedbin.org/api`. `SERVER_NAME` is the URL your redarc instance is running on. eg: `redarc.basedbin.org` +## Docker compose + +``` +$ wget https://raw.githubusercontent.com/Yakabuff/redarc/master/docker-compose.yml +// Modify docker-compose.yml as-needed +$ docker-compose up -d +``` + +Docker compose with elasticsearch + +``` +$ wget https://raw.githubusercontent.com/Yakabuff/redarc/master/docker-compose-es.yml +// Modify docker-compose-es.yml as-needed +$ docker-compose -f docker-compose-es.yml up -d +``` + +## Docker run + ``` $ git clone https://github.com/Yakabuff/redarc.git diff --git a/docker-compose-es.yml b/docker-compose-es.yml new file mode 100644 index 0000000..ecffbd4 --- /dev/null +++ b/docker-compose-es.yml @@ -0,0 +1,58 @@ +version: '3' + +services: + + postgres: + image: postgres + container_name: pgsql-dev + networks: + - redarc + environment: + POSTGRES_PASSWORD: test1234 + volumes: + - pgredarc01:/var/lib/postgresql/data + ports: + - "5432:5432" + + redarc: + build: + context: https://github.com/Yakabuff/redarc.git + dockerfile: Dockerfile + image: redarc + container_name: redarc + networks: + - redarc + environment: + REDARC_API: http://redarc.mysite.org/api/ + SERVER_NAME: redarc.mysite.org + PGPASSWORD: test1234 + ES_ENABLED: 'true' + ES_HOST: http://es.mysite.org + ES_PASSWORD: estest1234 + ports: + - "8080:80" + depends_on: + - postgres + - elasticsearch + + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:8.8.1 + container_name: es01 + networks: + - redarc + environment: + - discovery.type=single-node + - ELASTIC_PASSWORD=estest1234 + - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m" + volumes: + - esredarc01:/usr/share/elasticsearch/data + +networks: + redarc: + driver: bridge + +volumes: + pgredarc01: + driver: local + esredarc01: + driver: local diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7f987c8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +version: '3' + +services: + + postgres: + image: postgres + container_name: pgsql-dev + networks: + - redarc + environment: + POSTGRES_PASSWORD: test1234 + volumes: + - pgredarc01:/var/lib/postgresql/data + ports: + - "5432:5432" + + redarc: + build: + context: https://github.com/Yakabuff/redarc.git + dockerfile: Dockerfile + image: redarc + container_name: redarc + networks: + - redarc + environment: + REDARC_API: http://redarc.mysite.org/api/ + SERVER_NAME: redarc.mysite.org + PGPASSWORD: test1234 + ports: + - "8080:80" + depends_on: + - postgres + +networks: + redarc: + driver: bridge + +volumes: + pgredarc01: + driver: local \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh index d257dc8..9a14ab3 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -25,7 +25,7 @@ cp -R dist/* /var/www/html/redarc/ # NGINX config cd /redarc/nginx python3 nginx_envar.py $REDARC_API $SERVER_NAME -mv redarc.conf /etc/nginx/conf.d/redarc.conf +mv redarc.conf /etc/nginx/http.d/redarc.conf # Start nginx nginx -g "daemon off;" \ No newline at end of file