Skip to content

Commit 2e82ea0

Browse files
committed
build: dockerfile and docker-compose.yml file added
1 parent e3bf095 commit 2e82ea0

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Install dependencies
2+
FROM node:alpine AS deps
3+
RUN apk add --no-cache libc6-compat
4+
WORKDIR /app
5+
COPY package.json ./
6+
RUN yarn install --frozen-lockfile
7+
8+
# Rebuild the source code
9+
FROM node:alpine AS builder
10+
WORKDIR /app
11+
COPY . .
12+
COPY --from=deps /app/node_modules ./node_modules
13+
RUN yarn build && yarn install --production --ignore-scripts --prefer-offline
14+
15+
# Production image, copy all the files and run next
16+
FROM node:alpine AS runner
17+
WORKDIR /app
18+
ENV NODE_ENV production
19+
RUN addgroup -g 1001 -S nodejs
20+
RUN adduser -S nextjs -u 1001
21+
22+
COPY --from=builder /app/next.config.js ./
23+
COPY --from=builder /app/public ./public
24+
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
25+
COPY --from=builder /app/node_modules ./node_modules
26+
COPY --from=builder /app/package.json ./package.json
27+
28+
# Execute script
29+
RUN apk add --no-cache --upgrade bash
30+
USER nextjs
31+
EXPOSE 3000
32+
ENV PORT 3000
33+
CMD ["node_modules/.bin/next", "start"]

docker-compose.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: "3.8"
2+
services:
3+
sql-translator:
4+
container_name: sql-translator
5+
build: .
6+
env_file:
7+
- .env.production
8+
ports:
9+
- "3000:3000"

0 commit comments

Comments
 (0)