Skip to content

Commit

Permalink
Try multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielOaks committed Sep 12, 2023
1 parent 956fcd2 commit 8bb7217
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
FROM node:20.5.0-alpine
# multistage docker, to reduce the final image size

## build image
#
FROM node:20.5.0-alpine as build

# destination dir
RUN mkdir -p /usr/src/nuxt-app
Expand All @@ -13,6 +17,14 @@ COPY . /usr/src/nuxt-app/
RUN yarn install
RUN yarn build

## main image
#
FROM node:20.5.0-alpine as main

RUN mkdir -p /usr/src
COPY --from=build /usr/src/nuxt-app /usr/src/nuxt-app
WORKDIR /usr/src/nuxt-app

EXPOSE 3000

ENV NUXT_HOST=0.0.0.0
Expand Down

0 comments on commit 8bb7217

Please sign in to comment.