Skip to content

Commit

Permalink
chore: backend can now be executed in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Slartibartfass2 committed Dec 17, 2024
1 parent bb90de9 commit a85dfe2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Backend deno/nodejs server written in typescript.

## Run

```bash
docker compose --profile run -f unitTests/docker-compose.yml --env-file unitTests/.env up --abort-on-container-exit
```

## Tests

The tests require a running postgres database.
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,4 @@ app.use(async (ctx, next) => {
app.use(router.routes());
app.use(router.allowedMethods());

await app.listen({ port: 80 });
await app.listen({ port: 8080 });
2 changes: 1 addition & 1 deletion unitTests/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ADMIN_PASSWORD='Po&ago3K3@22udGt'
SALT='4%G&^x8zspfZJLHe'
DAYS_UNTIL_VALIDATION_GONE='14'
SECRET='79NbvC@%sy3Y4ysC'
PORT='80'
PORT='8080'
POSTGRES_HOST='postgresdb'
POSTGRES_DB='snowballR'
POSTGRES_USER='snowballR-admin'
Expand Down
8 changes: 4 additions & 4 deletions unitTests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
backend-test:
image: denoland/deno:2.1.3
command: bash -c "ls -a -l && deno test --allow-env --allow-read --allow-net --allow-write --allow-import --no-check --unstable-worker-options --coverage=cov_profile --no-prompt;
deno --unstable coverage cov_profile --lcov > cov_profile.lcov;
deno coverage cov_profile --lcov > cov_profile.lcov;
sed -i -e 's/\/app\/src/src/g' cov_profile.lcov"
working_dir: /app
volumes:
Expand All @@ -44,13 +44,13 @@ services:
profiles:
- test
backend:
image: denoland/deno:1.15.1
command: bash -c "ls -a -l && deno --version && deno run --no-check --allow-env --allow-read --allow-write --allow-net --unstable ./src/main.ts;"
image: denoland/deno:2.1.3
command: bash -c "ls -a -l && deno --version && deno run --allow-env --allow-read --allow-net --allow-write --allow-import --no-check --unstable-worker-options --no-prompt ./src/main.ts;"
working_dir: /app
volumes:
- ../:/app
ports:
- "80:80"
- "8080:8080"
environment:
- URL=${URL}
- POSTGRES_HOST=${POSTGRES_HOST}
Expand Down

0 comments on commit a85dfe2

Please sign in to comment.