Skip to content

Commit

Permalink
feat: update dockerfile and docker-compose
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Broudoux <[email protected]>
  • Loading branch information
abroudoux committed Oct 18, 2024
1 parent ebf3d42 commit 75a4371
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ RUN pnpm install --frozen-lockfile

COPY . .

ENV DATABASE_URL="postgresql://postgres:mysecretpassword@better-db:5432/better-db"

RUN pnpm run build

RUN pnpm run generate
RUN pnpm run migrate

EXPOSE 5173

CMD ["pnpm", "run", "dev"]
CMD ["sh", "-c", "pnpm run generate && pnpm run migrate && pnpm run dev"]
30 changes: 30 additions & 0 deletions docker-compose.build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
services:
app:
container_name: better-app
image: better-app:latest
build:
context: .
dockerfile: Dockerfile
ports:
- "5173:5173"
depends_on:
- db
environment:
DATABASE_URL: "postgresql://postgres:mysecretpassword@db:5432/better-db"
command: >
sh -c "pnpm install && pnpm run generate && pnpm run migrate && pnpm run dev"
db:
container_name: better-db
image: postgres:latest
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_DB: better-db
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data

volumes:
postgres_data:

0 comments on commit 75a4371

Please sign in to comment.