Skip to content

Commit bc54250

Browse files
committed
Added Dockerfile and docker-compose.yml for dev
1 parent d763456 commit bc54250

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

.dockerignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Ignore node_modules and logs
2+
node_modules
3+
npm-debug.log
4+
yarn-debug.log
5+
yarn-error.log
6+
.pnpm-debug.log
7+
package-lock.json.backup
8+
9+
# Ignore local development settings
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
15+
# Ignore build output
16+
.next
17+
out
18+
build
19+
20+
# Ignore IDE and editor config
21+
.vscode/
22+
.idea/
23+
*.swp
24+
*.swo
25+
*.tmp
26+
.DS_Store
27+
*.bak
28+
29+
# Ignore miscellaneous
30+
coverage
31+
*.log
32+
*.pid
33+
*.seed
34+
*.sqlite
35+
*.tgz
36+
.cache
37+
*.tsbuildinfo
38+
39+
# Ignore Docker-related files that should not be copied into the image
40+
Dockerfile*
41+
docker-compose.*

Dockerfile.dev

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM node AS base
2+
WORKDIR /app
3+
RUN npm i -g pnpm
4+
COPY package*.json .
5+
6+
RUN pnpm install
7+
8+
COPY . .
9+
10+
FROM node as release
11+
WORKDIR /app
12+
RUN npm i -g pnpm next
13+
RUN npm install -g tailwindcss postcss autoprefixer
14+
15+
COPY --from=base /app/node_modules ./node_modules
16+
COPY --from=base /app/package.json ./package.json
17+
COPY --from=base /app/.next ./.next
18+
COPY --from=base /app/app ./app
19+
COPY --from=base /app .
20+
21+
EXPOSE 3000
22+
23+
CMD ["pnpm", "dev"]

docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
dev:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile.dev
6+
container_name: demo-nextjs-dev
7+
environment:
8+
- WATCHPACK_POLLING=true
9+
volumes:
10+
- .:/app
11+
- /app/node_modules
12+
- /app/.next
13+
ports:
14+
- "3000:3000"
15+
env_file:
16+
- .env

0 commit comments

Comments
 (0)