2
1
mirror of https://github.com/Thream/api.git synced 2024-07-06 12:50:12 +02:00

chore: simplify Docker setup

This commit is contained in:
Divlo 2022-08-30 17:57:29 +02:00
parent 400dc7ec2a
commit de34618a7c
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
4 changed files with 3 additions and 47 deletions

View File

@ -13,10 +13,9 @@ FROM node:16.17.0 AS runner
WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/docker-start.sh ./docker-start.sh
COPY --from=builder /usr/src/app/package.json ./package.json
COPY --from=builder /usr/src/app/email ./email
COPY --from=builder /usr/src/app/build ./build
COPY --from=builder /usr/src/app/prisma ./prisma
USER node
CMD ["./docker-start.sh"]
CMD ["node", "build/index.js"]

View File

@ -49,6 +49,8 @@ the root of the project (see `.env.example`).
### Local Development environment
Recommended to use [VSCode: Remote development in Containers](https://code.visualstudio.com/docs/remote/containers-tutorial).
#### Setup the database
```sh
@ -76,18 +78,6 @@ npm run dev
npm run prisma:studio
```
### Production environment with [Docker](https://www.docker.com/)
```sh
# Setup and run all the services for you
docker-compose up --build
```
#### Services started
- API : `http://localhost:8080`
- [PostgreSQL database](https://www.postgresql.org/)
## 💡 Contributing
Anyone can help to improve the project, submit a Feature Request, a bug report or

View File

@ -1,29 +0,0 @@
version: '3.0'
services:
thream-api:
container_name: ${COMPOSE_PROJECT_NAME}
build:
context: './'
env_file:
- '.env'
ports:
- '${PORT}:${PORT}'
depends_on:
- 'thream-database'
volumes:
- './uploads:/usr/src/app/uploads'
restart: 'unless-stopped'
thream-database:
container_name: 'thream-database'
image: 'postgres:14.2'
environment:
POSTGRES_USER: 'user'
POSTGRES_PASSWORD: 'password'
POSTGRES_DB: 'thream'
volumes:
- 'database-volume:/var/lib/postgresql/data'
restart: 'unless-stopped'
volumes:
database-volume:

View File

@ -1,4 +0,0 @@
#!/bin/bash
npm run prisma:migrate:deploy
node build/index.js