Skip to content

Commit

Permalink
Refactor Dockerfile and docker-compose.dev.yml files
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsanghaffar committed Feb 1, 2024
1 parent 368e014 commit 8b19242
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 72 deletions.
22 changes: 0 additions & 22 deletions Dockerfile

This file was deleted.

39 changes: 10 additions & 29 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,22 @@
FROM node:20-alpine AS deps
FROM node:18-alpine

# RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY package.json yarn.lock ./
RUN yarn
RUN mkdir -p /app

FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

ENV NEXT_TELEMETRY_DISABLED 1
COPY package.json /app

RUN yarn global add next react react-dom
RUN npm install -g next

RUN yarn build

FROM node:20-alpine AS runner
WORKDIR /app
RUN npm install

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
COPY . /app

RUN yarn global add next react react-dom
RUN mkdir -p /app/.next/cache/images
VOLUME /app/.next/cache/images

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json

USER nextjs
RUN npm run build

EXPOSE 3000

ENV PORT 3000

CMD ["yarn", "start"]
CMD npm run start
16 changes: 7 additions & 9 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
version: '3.8'
version: "3.8"
services:
web:
biogpt:
build:
context: .
dockerfile: dev.Dockerfile
# target: runner
dockerfile: Dockerfile
restart: always
volumes:
- .:/app
command: yarn start
- /app/node_modules
- /app/.next
ports:
- "3000:3000"
environment:
NODE_ENV: development
- "3000:3000"
12 changes: 0 additions & 12 deletions docker-compose.yml

This file was deleted.

0 comments on commit 8b19242

Please sign in to comment.