-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
49 lines (40 loc) · 1.02 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM node:lts-alpine as builder
RUN apk add --no-cache git
WORKDIR /home/node
COPY package.json ./
COPY yarn.lock ./
# Install all packages
RUN yarn install
COPY . .
# Build AdonisJS for production
RUN yarn build
# Install only production node modules
FROM node:lts-alpine as prod_packages
RUN apk add --no-cache git
WORKDIR /home/node
COPY package.json ./
COPY yarn.lock ./
# Install only prod packages
RUN yarn install --production=true
# Build final runtime container
FROM node:lts-alpine
# Set environment variables
ENV NODE_ENV=production
USER node
RUN mkdir -p /home/node/app/
# Set working directory
WORKDIR /home/node/app
# Copy over required files from previous steps
# Copy over built files
COPY --from=builder /home/node/.nuxt ./.nuxt
# Copy over node_modules
COPY --from=prod_packages /home/node/node_modules ./node_modules
# Copy over package.json files
COPY package.json ./
COPY yarn.lock ./
COPY tsconfig.json ./
COPY nuxt.config.ts ./
# Expose port 3333 to outside world
EXPOSE 3000
# Start server up
CMD [ "yarn", "start" ]