Skip to content

Commit

Permalink
feat: adding Dockerfile and compose files
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmarcou committed Jul 29, 2024
1 parent 32dfb8d commit a0d20a3
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 7 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG NODE_VERSION=22.0.0

FROM node:${NODE_VERSION}-alpine

ENV NPM_CONFIG_LOGLEVEL info

WORKDIR /app

# Copy package root
COPY ./package.json ./.
COPY ./package-lock.json ./.
COPY ./tsconfig.json ./.

# Npm clean-install
RUN npm ci

# Copy source code
COPY ./src ./src/

RUN npm run build

ENTRYPOINT ["npm", "run"]

CMD ["start"]
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# govbot

A discord bot for collective decision making, with the goal of being both *effective*, and *aligned*.
A discord bot for collective decision making, with the goal of being both _effective_, and _aligned_.

Some principles it follows:

*aligned*
_aligned_

- Decisions aren't enacted without the approval and input of the community they impact.

*effective*
_effective_

- Decisions pull in the expertise of the community and relevant subject-matter-experts.

Expand All @@ -28,8 +28,8 @@ CLIENT_ID=your_client_id (A.K.A. application id)
GUILD_ID=your_guild_id (A.K.A. server id)
PUBLIC_KEY=your_apps_public_key
```
4. Run `npm run dev` to start the bot in development mode

4. Run `npm run dev` to start the bot in development mode

## Checking For Required Channels

Expand All @@ -54,4 +54,26 @@ To make a contribution, follow these steps:
1. Make an issue that includes a user story for what the user should be able to do.
2. Get that issue tested by: es92, Remigiusz-antczak or Cristina Echeverry.
3. Get that issue approved by the product owners: es92, Remigiusz-antczak or Cristina Echeverry.
4. Write a PR and get it approved by the code owners and Mina devops: Es92, illya (developer), johnmarcou & Smorci (Mina devops). Each PR must correspond to an approved issue. By default, PRs should be merged by the PR submitter, though in some cases if changes are needed, they can be merged by code owners.
4. Write a PR and get it approved by the code owners and Mina devops: Es92, illya (developer), johnmarcou (Mina devops). Each PR must correspond to an approved issue. By default, PRs should be merged by the PR submitter, though in some cases if changes are needed, they can be merged by code owners.

## Docker image

### Build it

```
docker build -t <your-image-name>:<your-image-tag> .
```

### Run it

```
docker run -it -d --env-file ./.env <your-image-name>:<your-image-tag>
```

The `--env-file` flag takes a filename as an argument and expects each line to be in the VAR=VAL format, mimicking the argument passed to `--env`. Comment lines need only be prefixed with #

### Test it

```
docker-compose up --build
```
13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
bot:
image: pgt-gov-bot
build: .
env_file:
- .env
environment:
DATABASE: /data/database.sqlite
volumes:
- database-data:/data/

volumes:
database-data:
176 changes: 174 additions & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@types/ws": "^8.5.10",
"discord.js": "^14.15.3",
"dotenv": "^16.4.5",
"sequelize": "^6.37.3",
"sqlite": "^5.1.1",
"sqlite3": "^5.1.7",
"yargs": "^17.7.2"
Expand Down

0 comments on commit a0d20a3

Please sign in to comment.