-
Notifications
You must be signed in to change notification settings - Fork 2
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
17843f4
commit 8015050
Showing
7 changed files
with
62 additions
and
21 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 |
---|---|---|
|
@@ -9,5 +9,8 @@ README.md | |
node_modules | ||
build | ||
|
||
node_modules | ||
build | ||
|
||
# Envs | ||
**/.env.local | ||
**/.env.local |
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,31 +1,44 @@ | ||
# Node builder image | ||
FROM uselagoon/node-20-builder:latest AS builder | ||
FROM uselagoon/node-20-builder:latest AS dev | ||
|
||
COPY . /app/ | ||
# Copy only what we need into the image | ||
COPY ./src/ /app/src | ||
COPY server.js . | ||
COPY plugins.json . | ||
COPY package.json . | ||
COPY yarn.lock . | ||
COPY tour.json . | ||
COPY tourHash.js . | ||
|
||
RUN yarn install --network-timeout 300000 | ||
# Upgrade the yarn version in /app to the most recent to take advantage of new features | ||
RUN yarn set version berry | ||
|
||
|
||
# Node service image | ||
FROM uselagoon/node-20:latest | ||
# use a buildkit cache for yarn - this is reused in later steps | ||
RUN --mount=type=cache,target=/home/.yarn YARN_CACHE_FOLDER=/home/.yarn yarn install --network-timeout 300000 | ||
|
||
ARG LAGOON_VERSION | ||
ARG GRAPHQL_API | ||
ARG KEYCLOAK_API | ||
ENV LAGOON_VERSION=$LAGOON_VERSION | ||
ENV GRAPHQL_API=$GRAPHQL_API | ||
ENV KEYCLOAK_API=$KEYCLOAK_API | ||
|
||
# Copy the node_modules from node builder | ||
COPY --from=builder /app/node_modules /app/node_modules | ||
# Use an intermediate image to build and trim the production image | ||
FROM uselagoon/node-20:latest AS prod-builder | ||
|
||
# Copying files from ui service | ||
COPY . /app/ | ||
# Copy the whole /app folder from dev | ||
COPY --from=dev /app/ /app/ | ||
|
||
ARG KEYCLOAK_API | ||
ENV KEYCLOAK_API=$KEYCLOAK_API | ||
# Build app | ||
RUN --mount=type=cache,target=/home/.yarn YARN_CACHE_FOLDER=/home/.yarn yarn run build | ||
# Remove any node_modules in DevDependencies not needed for production | ||
RUN --mount=type=cache,target=/home/.yarn YARN_CACHE_FOLDER=/home/.yarn yarn workspaces focus -A --production | ||
|
||
ARG GRAPHQL_API | ||
ENV GRAPHQL_API=$GRAPHQL_API | ||
# Build the final production image | ||
FROM uselagoon/node-20:latest | ||
|
||
# Build app | ||
RUN yarn run build | ||
# Copy the whole /app folder from prod-builder | ||
COPY --from=prod-builder /app/ /app/ | ||
|
||
EXPOSE 3000 | ||
CMD ["yarn", "start"] |
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
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