From e67d61a1a314139b62358c470c7a23fd2d0594e3 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 2 Feb 2025 23:27:46 -0800 Subject: [PATCH] Add a Dockerfile --- .dockerignore | 4 ++++ .gitignore | 6 ++++++ Dockerfile | 16 ++++++++++++++++ Install.md | 10 ++++++++++ docker-compose.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bab5fb9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +logs +node_modules +dist +*.sqlite \ No newline at end of file diff --git a/.gitignore b/.gitignore index efae95c..4cb2ff0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,11 @@ settings.toml chatbot/ +*.sqlite + +# Binaries +BareBot +BareRTC + # Logs logs *.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d5dd97 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.23-alpine AS base + +RUN apk add make bash git nodejs npm + +WORKDIR /app + +COPY go.mod go.sum package.json package-lock.json ./ +RUN go mod download +RUN npm install + +COPY . ./ + +RUN npm run build +RUN make build + +CMD ["./BareRTC"] \ No newline at end of file diff --git a/Install.md b/Install.md index 603c7c2..7453bed 100644 --- a/Install.md +++ b/Install.md @@ -5,12 +5,22 @@ This document will explain how to download and install BareRTC on your own web s At this time, BareRTC is not released as a versioned pre-built archive, but as source code. This may change in the future but for now you'll need to git clone or download the source code and compile it, all of which should be easy to do on a Linux or macOS server. - [Installing BareRTC](#installing-barertc) + - [Docker Compose](#docker-compose) - [Requirements \& Dependencies](#requirements--dependencies) - [Installation](#installation) - [Deploying to Production](#deploying-to-production) - [Developing This App](#developing-this-app) - [License](#license) +## Docker Compose + +There is an easy docker-compose.yml in the git repo: + +```bash +docker-compose up +``` + +Look inside the file for more information. ## Requirements & Dependencies diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..77df96c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,48 @@ +version: "3" + +# Docker Compose manifest for BareRTC. +# +# Usage is simple: +# +# docker-compose up +# +# If happy, run `docker-compose up -d` to run it in the background. +# +# It will bind certain files in your current working directory: +# +# ./settings.toml for the app settings. +# ./database.sqlite for chat history DMs. +# ./logs for any log output written by the app. + +services: + + # BareRTC web app. + web: + build: . + container_name: barertc + ports: + - "9000:9000" # host:container + volumes: + - "./settings.toml:/app/settings.toml:z" + - "./database.sqlite:/app/database.sqlite:z" + - "./logs:/app/logs:z" + + # TURN server. + coturn: + image: "coturn/coturn:latest" + container_name: coturn_server + ports: + ## STUN/TURN + - "3478:3478" + - "3478:3478/udp" + # - "3479:3479" + # - "3479:3479/udp" + # - "80:80" + # - "80:80/udp" + ## STUN/TURN SSL + # - "5349:5349" + # - "5349:5349/udp" + # - "5350:5350" + # - "5350:5350/udp" + # - "443:443" + # - "443:443/udp" \ No newline at end of file