Skip to content

Commit 41a1b2d

Browse files
committed
Revert "fix/docker"
This reverts commit 5bb011c.
1 parent 5bb011c commit 41a1b2d

File tree

2 files changed

+27
-39
lines changed

2 files changed

+27
-39
lines changed

Dockerfile

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
1-
FROM node:18-alpine AS dependences
2-
WORKDIR /app
3-
4-
COPY package.json yarn.lock ./
5-
RUN yarn install --production --frozen-lockfile
1+
# Use the official Node.js image as the base image
2+
FROM node:18-alpine
63

7-
FROM node:18-alpine AS builder
4+
# Set the working directory inside the container
85
WORKDIR /app
96

10-
COPY package.json yarn.lock ./
11-
RUN yarn --frozen-lockfile
12-
13-
COPY . .
14-
15-
RUN npx prisma generate
16-
RUN NODE_OPTIONS="--max-old-space-size=4096" yarn build
17-
18-
FROM node:18-alpine AS runner
19-
WORKDIR /app
7+
# Copy package.json and package-lock.json to the working directory
8+
COPY package*.json ./
209

21-
ARG NODE_ENV=production
22-
ENV NODE_ENV=${NODE_ENV}
10+
# Install dependencies
11+
RUN npm install
2312

24-
COPY --from=dependences /app/node_modules ./node_modules
25-
COPY --from=builder /app/dist ./dist
26-
COPY entrypoint.sh prisma/* ./
13+
# Copy the rest of the application code to the working directory
14+
COPY . .
2715

28-
RUN chmod +x entrypoint.sh
16+
# Build the NestJS application
17+
RUN npm run build
2918

30-
EXPOSE 8000
19+
# Expose the port your NestJS application listens on
20+
EXPOSE 8080
3121

32-
ENTRYPOINT [ "./entrypoint.sh" ]
22+
# Define the command to run your NestJS application
23+
CMD ["node", "--max-old-space-size=4096", "dist/main.js"]

docker-compose.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: "3.8"
2-
services:
3-
dev-db:
2+
services:
3+
dev-db:
44
image: mysql:latest
55
ports:
66
- 3306:3306
@@ -11,24 +11,21 @@ services:
1111
MYSQL_DATABASE: gatewaydb
1212
networks:
1313
- mysql-network
14-
healthcheck:
15-
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
16-
interval: 10s
17-
timeout: 5s
18-
retries: 5
1914

20-
gateway-server:
21-
image: controller_webapp_backend-nest-app
22-
container_name: gateway-server
23-
env_file:
24-
- ./production.env
15+
nest-app:
16+
build:
17+
context: .
18+
dockerfile: Dockerfile # Points to your Dockerfile
2519
ports:
26-
- "8080:8080"
20+
- 8080:8080
2721
depends_on:
28-
dev-db:
29-
condition: service_healthy
22+
- dev-db
23+
environment:
24+
DATABASE_URL: mysql://root:dtth2802@dev-db:3306/gatewaydb
25+
NODE_ENV: .env
3026
networks:
3127
- mysql-network
28+
#command: ["node", "dist/main"] # Starts your NestJS app
3229

3330
networks:
3431
mysql-network:

0 commit comments

Comments
 (0)