add docker setup

This commit is contained in:
smanylov
2025-12-03 12:13:32 +07:00
parent 431b576d41
commit 11a751b2bc
6 changed files with 61 additions and 4 deletions
+7
View File
@@ -0,0 +1,7 @@
node_modules
.env
.git
.gitignore
.next
README.md
.dockerignore
+22
View File
@@ -0,0 +1,22 @@
FROM node:22.20.0 AS dependencies
WORKDIR /no-copy-frontend
COPY package.json package-lock.json ./
RUN npm install
FROM node:22.20.0 AS builder
WORKDIR /no-copy-frontend
COPY . .
COPY --from=dependencies /no-copy-frontend/node_modules ./node_modules
RUN npm run build
FROM node:22.20.0 AS runner
WORKDIR /no-copy-frontend
ENV NODE_ENV=production
COPY --from=builder /no-copy-frontend/public ./public
COPY --from=builder /no-copy-frontend/package.json ./package.json
COPY --from=builder /no-copy-frontend/.next ./.next
COPY --from=builder /no-copy-frontend/node_modules ./node_modules
EXPOSE 2999
CMD ["npm", "start"]
+5
View File
@@ -5,3 +5,8 @@ npm run dev
```
Open [http://localhost:2999](http://localhost:2999)
## Docker
docker run -d -p 2998:2999 --name no-copy-frontend no-copy-frontend
+23
View File
@@ -0,0 +1,23 @@
version: '3.8'
services:
frontend:
container_name: no-copy-frontend
build:
context: .
dockerfile: Dockerfile
ports:
- "2998:2999"
environment:
- NODE_ENV=production
- PORT=2999
volumes:
- ./public:/app/public
- ./package.json:/app/package.json
restart: unless-stopped
networks:
- no-copy-network
networks:
no-copy-network:
driver: bridge
+2 -2
View File
@@ -1,11 +1,11 @@
{
"name": "no-copy",
"name": "no-copy-frontend",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "no-copy",
"name": "no-copy-frontend",
"version": "0.1.0",
"dependencies": {
"@tailwindcss/postcss": "^4.1.17",
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "no-copy",
"name": "no-copy-frontend",
"version": "0.1.0",
"private": true,
"scripts": {