Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
config: adicionar dockerfile e docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
bfukumori committed Jul 11, 2024
1 parent 3bc6582 commit 4c2ebb1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.github
coverage
node_modules
.gitignore
.dockerignore
client.http
docker-compose.yml
Dockerfile
README.md
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:alpine

WORKDIR /home/app/api

COPY prisma ./prisma/
COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run prisma:generate

CMD ["npm", "run", "dev"]
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
api:
platform: linux/x86_64
build: ./
environment:
NODE_ENV: development
ports:
- 3333:3333
env_file:
- .env
volumes:
- ./:/home/app/api
- /home/app/api/node_modules
working_dir: /home/app/api
restart: on-failure
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"scripts": {
"dev": "tsx watch --env-file=.env src/server.ts",
"test": "vitest",
"coverage": "vitest run --coverage"
"coverage": "vitest run --coverage",
"prisma:migrate": "npx prisma migrate dev",
"prisma:generate": "npx prisma generate"
},
"prisma": {
"seed": "tsx prisma/seed.ts"
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fastify.register(createInvite);

const start = async () => {
try {
await fastify.listen({ port: PORT });
await fastify.listen({ port: PORT, host: '0.0.0.0' });
fastify.swagger();
console.log(`Server listening on port ${PORT}`);
} catch (err) {
Expand Down

0 comments on commit 4c2ebb1

Please sign in to comment.