Skip to content

Commit

Permalink
feat: dockerize app
Browse files Browse the repository at this point in the history
  • Loading branch information
savareyhano committed Dec 6, 2024
1 parent 4a30396 commit 4b4b06c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git
.env
**/node_modules/
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
FROM node:23-alpine AS base

RUN apk add --no-cache sqlite

WORKDIR /app

RUN mkdir -p /app/db
RUN sqlite3 /app/db/database.db "VACUUM;"

COPY ./yarn.lock ./package.json ./

RUN yarn install

COPY ./prisma ./prisma/

ENV DATABASE_URL=file:/app/db/database.db

RUN npx prisma migrate dev --name init

COPY ./ ./

FROM node:23-alpine

WORKDIR /app

COPY --from=base ./app ./

ENV DATABASE_URL=file:/app/db/database.db

CMD ["yarn", "dev"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ npx prisma migrate dev --name init
yarn dev
```

Atau pake docker

```bash
# jalankan
docker compose up -d

# untuk mematikan
docker compose down
```

buka API Documentation
[http://localhost:3000/api-docs](http://localhost:3000/api-docs)

Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
services:
app:
build: .
ports:
- '3000:3000'
restart: unless-stopped
environment:
JWT_SECRET: NAKANO_ITSUKI
volumes:
- sqlite_data:/app/db
volumes:
sqlite_data:

0 comments on commit 4b4b06c

Please sign in to comment.