generated from ConductionNL/nl-design-skeleton-gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
226674e
commit 1d7f5f1
Showing
2 changed files
with
51 additions
and
89 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
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,48 +1,12 @@ | ||
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage | ||
# https://docs.docker.com/compose/compose-file/#target | ||
FROM node:alpine as builder | ||
|
||
WORKDIR /app | ||
|
||
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact | ||
ARG NODE_VERSION=14 | ||
|
||
# "common" stage | ||
FROM node:${NODE_VERSION}-alpine AS api_platform_pwa_common | ||
|
||
EXPOSE 8000 | ||
|
||
WORKDIR /usr/src/pwa | ||
|
||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
ENV NEXT_PUBLIC_ME_URL=${NEXT_PUBLIC_ME_URL} | ||
|
||
# prevent the reinstallation of node modules at every changes in the source code | ||
COPY package.json yarn.lock ./ | ||
RUN yarn | ||
|
||
COPY . ./ | ||
|
||
VOLUME /usr/src/pwa/node_modules | ||
|
||
|
||
# "development" stage | ||
# depends on the "common" stage above | ||
FROM api_platform_pwa_common AS api_platform_pwa_dev | ||
|
||
ENV API_PLATFORM_CLIENT_GENERATOR_OUTPUT . | ||
RUN yarn global add @api-platform/client-generator | ||
|
||
CMD ["yarn", "develop"] | ||
|
||
|
||
# "build" stage | ||
# depends on the "common" stage above | ||
FROM api_platform_pwa_common AS api_platform_pwa_prod | ||
|
||
ENV NODE_ENV production | ||
ARG NEXT_PUBLIC_ENTRYPOINT | ||
|
||
RUN set -eux; \ | ||
yarn build | ||
|
||
CMD ["yarn", "develop"] | ||
COPY package.json . | ||
RUN npm install | ||
COPY . . | ||
RUN ["npm", "run", "build"] | ||
|
||
FROM nginx | ||
EXPOSE 80 | ||
COPY --from=builder /app/public /usr/share/nginx/html |