Skip to content

Commit 98a5341

Browse files
Include pedestrian in docker-compose.yml
1 parent 9fa37a0 commit 98a5341

File tree

10 files changed

+313
-286
lines changed

10 files changed

+313
-286
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
/.env
12
/LICENSE
23
/README.md
3-
/build
44
/dump.sql
55
/flyway
66

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/build
1+
/.env
22
/dump.sql
33

44
# JetBrains

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/build
1+
/.env
22
/dump.sql
33

44
# Git

Dockerfile

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
1-
FROM node:20.6.0 as buildDependencies
2-
WORKDIR /pedestrian
3-
COPY package*.json ./
4-
RUN npm ci
1+
FROM node:20.8.0
52

6-
FROM node:20.6.0 as dependencies
73
WORKDIR /pedestrian
4+
5+
# Express port
6+
EXPOSE 8080
7+
88
COPY package*.json ./
9-
ENV NODE_ENV=production
9+
1010
RUN npm ci
1111

12-
FROM node:20.6.0 as build
13-
WORKDIR /pedestrian
14-
COPY --from=buildDependencies /pedestrian/node_modules node_modules
1512
COPY . .
16-
RUN npm run check
17-
RUN npm run build
1813

19-
FROM node:20.6.0
20-
WORKDIR /pedestrian
21-
COPY --from=dependencies /pedestrian/node_modules node_modules
22-
COPY --from=build /pedestrian/build build
14+
RUN npm run check \
15+
&& npx tsc
2316

24-
EXPOSE 8080
2517
CMD node --no-warnings --enable-source-maps build/index.js

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A custom bot designed for [The Anti-Car Collective](https://discord.gg/anticar)
66

77
[Node.js](https://nodejs.org) and [docker-compose](https://docs.docker.com/compose) is required for development.
88

9-
Starting (`npm run start`) requires the project to be installed (`npm install`), built (`npm run build`), have services running (`npm run services`), and required [environment variables](#environment-variables) configured.
9+
Required [environment variables](#environment-variables) must be configured in a `.env` file at the project's root to start (`npm run start`).
1010

1111
It is recommended to dump (`npm run dump`) the database before migrating (`npm run migrate`) in case restoring (`npm run restore`) is required.
1212

@@ -23,13 +23,13 @@ Code must pass minimum quality standards checks (`npm run check`) to be merged:
2323
| BOT_GUILD_ID || | Guild ID to enable `/bot` |
2424
| DISCORD_TOKEN || | [Create Discord Token](https://discord.com/developers/docs/getting-started#configuring-your-bot) |
2525
| EXPRESS_PORT || 8080 | |
26-
| POSTGRESQL_HOST || localhost | |
26+
| POSTGRESQL_HOST || postgres | |
2727
| POSTGRESQL_PORT || 5432 | |
2828
| POSTGRESQL_DATABASE || db | |
2929
| POSTGRESQL_USER || user | |
3030
| POSTGRESQL_PASSWORD || password | |
3131
| PROJECT_NAME || Pedestrian | |
32-
| REDIS_HOST || localhost | |
32+
| REDIS_HOST || redis | |
3333
| REDIS_PORT || 6379 | |
3434
| REDIS_CLUSTER || | IIF value is "true" then Redis will run in [cluster mode](https://redis.io/docs/management/scaling/) |
3535
| REDIS_USERNAME || | |

docker-compose.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1+
version: "3.8"
12
services:
2-
flyway:
3-
build: flyway
4-
command:
5-
- "-url=jdbc:postgresql://postgres:5432/db"
6-
- "-user=user"
7-
- "-password=password"
8-
- "-connectRetries=60"
9-
- "migrate"
10-
depends_on:
11-
- postgres
123
postgres:
13-
image: postgres:15.4
4+
container_name: postgres
5+
image: postgres:16.0
146
environment:
157
- POSTGRES_USER=user
168
- POSTGRES_PASSWORD=password
179
- POSTGRES_DB=db
1810
ports:
1911
- 5432:5432
2012
redis:
21-
image: redis:7.2.0
13+
container_name: redis
14+
image: redis:7.2.1
2215
ports:
2316
- 6379:6379
17+
flyway:
18+
container_name: flyway
19+
build: flyway
20+
command:
21+
- "-url=jdbc:postgresql://postgres:5432/db"
22+
- "-user=user"
23+
- "-password=password"
24+
- "-connectRetries=60"
25+
- "migrate"
26+
depends_on:
27+
- postgres
28+
pedestrian:
29+
container_name: pedestrian
30+
build: .
31+
env_file: .env
32+
depends_on:
33+
- postgres
34+
- redis
35+
- flyway

flyway/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
FROM flyway/flyway:9.22.1-alpine
1+
FROM flyway/flyway:9.22.2-alpine
22

33
COPY sql/* /flyway/sql

0 commit comments

Comments
 (0)