-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,38 @@ | ||
FROM node:alpine | ||
FROM node:alpine AS builder | ||
|
||
RUN apk add --no-cache libc6-compat | ||
|
||
WORKDIR /usr/src/app | ||
|
||
ADD ../../../frontend frontend | ||
ADD ../../../common common | ||
|
||
WORKDIR /usr/src/app/common | ||
RUN yarn | ||
RUN yarn install --frozen-lockfile | ||
RUN yarn build | ||
|
||
WORKDIR /usr/src/app/frontend | ||
RUN echo 'BACKEND_URL=http://backend:8080' >> .env | ||
RUN echo 'NODE_ENV=production' >> .env | ||
RUN yarn | ||
RUN yarn install --frozen-lockfile | ||
RUN yarn build | ||
RUN rm -rf src | ||
RUN yarn cache clean | ||
|
||
FROM node:alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
WORKDIR /usr/src/app/frontend | ||
COPY --from=builder /usr/src/app/frontend/public ./public | ||
COPY --from=builder /usr/src/app/frontend/package.json ./package.json | ||
COPY --from=builder /usr/src/app/frontend/.next/standalone ./ | ||
COPY --from=builder /usr/src/app/frontend/.next/static ./.next/static | ||
|
||
WORKDIR /usr/src/app/common | ||
COPY --from=builder /usr/src/app/common/package.json ./package.json | ||
COPY --from=builder /usr/src/app/common/dist ./dist | ||
COPY --from=builder /usr/src/app/common/node_modules ./node_modules | ||
|
||
WORKDIR /usr/src/app/frontend | ||
EXPOSE 8080 | ||
|
||
CMD [ "yarn", "start" ] | ||
CMD [ "node", "server.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,5 @@ module.exports = withBundleAnalyzer({ | |
} | ||
return config | ||
}, | ||
output: 'standalone', | ||
}) |