Skip to content

Commit

Permalink
Add Docker Compose Files & Update Dockerfile to use Alpine Linux
Browse files Browse the repository at this point in the history
* 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: #13
  • Loading branch information
ryebreadgit committed Jun 18, 2023
1 parent f3cb341 commit 5b81895
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 10 deletions.
14 changes: 5 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,4 +16,4 @@ RUN npm ci

WORKDIR /redarc
RUN chmod +x scripts/start.sh
CMD ["scripts/start.sh"]
CMD ["/bin/bash", "scripts/start.sh"]
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 58 additions & 0 deletions docker-compose-es.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;"

0 comments on commit 5b81895

Please sign in to comment.