Skip to content

Commit

Permalink
Merge pull request #1 from mayudev/docker
Browse files Browse the repository at this point in the history
Docker
  • Loading branch information
mayudev authored Apr 17, 2022
2 parents 26f6371 + 0d9880b commit 4de9382
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 3 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:17-alpine AS build
RUN apk add --no-cache python3 g++ make
RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /build/
COPY package* ./
RUN npm install
COPY . .
RUN npm run build

FROM node:17-alpine AS prod
WORKDIR /app
COPY --from=build /build .
CMD ["npm", "start"]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

## 🔩 Setup

New: You can use [Docker](#using-docker) instead.

**Node v16+ is required!**

Important: this bot is meant to be used in one server (Discord+Revolt), but can be used in more as long as they share the same admin.
Expand Down Expand Up @@ -57,6 +59,23 @@ Of course, replace ... with tokens.

Note: it's recommended to use something like [pm2](https://pm2.keymetrics.io/) or [nodemon](https://nodemon.io/) to run the bot. Make sure to pass the `--experimental-specifier-resolution=node` flag to node manually, otherwise it will not run (it's included in the default start script).

### Using Docker

You need Docker and docker-compose installed.

Follow the steps above to create a `.env` file[^1]. You do not have to run `npm install` and `npm run build`, obviously. Also, make sure your bots have all the required permissions as explained above.

Before you run docker-compose, use `touch revcord.sqlite` to create the database file and leave it empty.

Then you should be ready to go.

```
docker-compose up -d
```

[^1]: Alternatively, you can edit the `docker-compose.yml` file appropriately. Make sure to remove `./.env:/app/.env` below `volumes:` so it won't complain when you don't have a `.env` file.


## 🔧 Configuration

### with commands
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.7"

services:
revcord:
build:
dockerfile: Dockerfile
volumes:
- ./revcord.sqlite:/app/revcord.sqlite:rw
- ./.env:/app/.env
restart: unless-stopped
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "revcord",
"version": "1.0.0",
"version": "1.1.0",
"description": "A discord-revolt bridge",
"type": "module",
"scripts": {
Expand Down

0 comments on commit 4de9382

Please sign in to comment.