2020-05-19 16:38:18 +02:00
|
|
|
# ---------------
|
2020-05-07 22:42:40 +02:00
|
|
|
# Install Dependencies
|
2020-05-19 16:38:18 +02:00
|
|
|
# ---------------
|
2020-05-19 16:47:00 +02:00
|
|
|
FROM arm64v8/node:12.16-alpine as build
|
2020-05-07 22:42:40 +02:00
|
|
|
|
|
|
|
# Install dependencies neccesary for node-gyp on node alpine
|
2020-05-19 16:38:18 +02:00
|
|
|
RUN apk add --update --no-cache \
|
|
|
|
python \
|
|
|
|
make \
|
|
|
|
g++
|
2020-05-07 22:42:40 +02:00
|
|
|
|
|
|
|
# Install app dependencies
|
|
|
|
COPY package.json .
|
2020-05-26 09:08:48 +02:00
|
|
|
COPY package-lock.json .
|
2020-08-09 16:03:18 +02:00
|
|
|
RUN npm install --silent
|
|
|
|
|
|
|
|
# Build the NextJS application
|
|
|
|
COPY . .
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
# Remove non production necessary modules
|
|
|
|
RUN npm prune --production
|
2020-05-12 12:16:44 +02:00
|
|
|
|
2020-05-07 22:42:40 +02:00
|
|
|
# ---------------
|
|
|
|
# Build App
|
|
|
|
# ---------------
|
2020-05-19 16:47:00 +02:00
|
|
|
FROM arm64v8/node:12.16-alpine
|
2020-05-07 22:42:40 +02:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2020-08-09 16:03:18 +02:00
|
|
|
# Copy dependencies and build from build stage
|
2020-05-07 22:42:40 +02:00
|
|
|
COPY --from=build node_modules node_modules
|
2020-08-09 16:03:18 +02:00
|
|
|
COPY --from=build .next .next
|
2020-05-07 22:42:40 +02:00
|
|
|
|
|
|
|
# Bundle app source
|
|
|
|
COPY . .
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2020-05-12 12:16:44 +02:00
|
|
|
CMD [ "npm", "start" ]
|