From 0abc79ddc483d540bb00d2436a06f35060878598 Mon Sep 17 00:00:00 2001 From: Shashank Budhanuru Ramaraju Date: Fri, 27 Sep 2024 00:38:31 +0100 Subject: [PATCH] use node alpine and fix Mac issue --- Dockerfile | 102 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index f83bcd29..78812d61 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,111 @@ # syntax=docker/dockerfile:1 -FROM node:18 AS setup +# FROM node:18-alpine AS build +# WORKDIR /app + +# COPY package.json yarn.lock .yarnrc.yml ./ +# COPY .yarn/ .yarn/ +# COPY packages/ packages/ +# RUN find packages/ -type f \! \( -name "package.json" -o -name "yarn.lock" \) -delete +# RUN find . -type d -empty -delete +# RUN yarn install --immutable +# COPY . . +# WORKDIR /app/packages/apollo-collaboration-server +# RUN yarn build + +# FROM node:18-alpine +# WORKDIR /app + +# COPY --from=build /app/packages/apollo-collaboration-server/dist /app/packages/apollo-collaboration-server/dist +# COPY --from=build /app/packages/apollo-common/dist /app/packages/apollo-common/dist +# COPY --from=build /app/packages/apollo-mst/dist /app/packages/apollo-mst/dist +# COPY --from=build /app/packages/apollo-schemas/dist /app/packages/apollo-schemas/dist +# COPY --from=build /app/packages/apollo-shared/dist /app/packages/apollo-shared/dist + +# COPY package.json yarn.lock .yarnrc.yml ./ +# COPY .yarn/ .yarn/ +# RUN yarn workspaces focus --production @apollo-annotation/collaboration-server + +# EXPOSE 3999 +# CMD ["yarn", "start:prod"] + +# syntax=docker/dockerfile:1 + +# FROM node:18 AS setup +# WORKDIR /app +# COPY package.json yarn.lock .yarnrc.yml ./ +# COPY .yarn/ .yarn/ +# COPY packages/ packages/ +# RUN find packages/ -type f \! \( -name "package.json" -o -name "yarn.lock" \) -delete +# RUN find . -type d -empty -delete +# RUN yarn install --immutable +# COPY . . +# WORKDIR /app/packages/apollo-collaboration-server +# RUN yarn build + +# FROM node:18 +# LABEL org.opencontainers.image.source=https://github.com/GMOD/Apollo3 +# LABEL org.opencontainers.image.description="Apollo collaboration server" +# WORKDIR /app +# COPY --from=setup /app . +# COPY --from=setup /app/packages/apollo-collaboration-server/dist /app/packages/apollo-collaboration-server/dist +# COPY --from=setup /app/packages/apollo-common/dist /app/packages/apollo-common/dist +# COPY --from=setup /app/packages/apollo-mst/dist /app/packages/apollo-mst/dist +# COPY --from=setup /app/packages/apollo-schemas/dist /app/packages/apollo-schemas/dist +# COPY --from=setup /app/packages/apollo-shared/dist /app/packages/apollo-shared/dist +# RUN yarn workspaces focus --production @apollo-annotation/collaboration-server +# EXPOSE 3999 +# CMD ["yarn", "start:prod"] + + +# WORKING - 2.5GB +# FROM node:18-alpine AS build +# WORKDIR /app + +# COPY package.json yarn.lock .yarnrc.yml ./ +# COPY .yarn/ .yarn/ +# COPY packages/ packages/ +# RUN find packages/ -type f \! \( -name "package.json" -o -name "yarn.lock" \) -delete +# RUN find . -type d -empty -delete +# RUN yarn install --immutable +# COPY . . +# WORKDIR /app/packages/apollo-collaboration-server +# RUN yarn build +# EXPOSE 3999 +# CMD ["yarn", "start:prod"] +# WORKING + + +FROM node:18-alpine AS build WORKDIR /app + COPY package.json yarn.lock .yarnrc.yml ./ COPY .yarn/ .yarn/ COPY packages/ packages/ -RUN find packages/ -type f \! \( -name "package.json" -o -name "yarn.lock" \) -delete && \ -find . -type d -empty -delete - -FROM node:18 AS build -WORKDIR /app -COPY --from=setup /app . +RUN find packages/ -type f \! \( -name "package.json" -o -name "yarn.lock" \) -delete +RUN find . -type d -empty -delete RUN yarn install --immutable COPY . . WORKDIR /app/packages/apollo-collaboration-server RUN yarn build -FROM node:18 -LABEL org.opencontainers.image.source=https://github.com/GMOD/Apollo3 -LABEL org.opencontainers.image.description="Apollo collaboration server" +FROM node:18-alpine WORKDIR /app -COPY --from=setup /app . COPY --from=build /app/packages/apollo-collaboration-server/dist /app/packages/apollo-collaboration-server/dist COPY --from=build /app/packages/apollo-common/dist /app/packages/apollo-common/dist COPY --from=build /app/packages/apollo-mst/dist /app/packages/apollo-mst/dist COPY --from=build /app/packages/apollo-schemas/dist /app/packages/apollo-schemas/dist COPY --from=build /app/packages/apollo-shared/dist /app/packages/apollo-shared/dist +COPY --from=build /app/packages/apollo-shared/package.json /app/packages/apollo-shared/package.json +COPY --from=build /app/packages/apollo-schemas/package.json /app/packages/apollo-schemas/package.json +COPY --from=build /app/packages/apollo-mst/package.json /app/packages/apollo-mst/package.json +COPY --from=build /app/packages/apollo-common/package.json /app/packages/apollo-common/package.json +COPY --from=build /app/packages/apollo-collaboration-server/package.json /app/packages/apollo-collaboration-server/package.json +COPY --from=build /app/package.json /app/package.json +COPY --from=build /app/yarn.lock /app/yarn.lock +COPY --from=build /app/.yarnrc.yml /app/.yarnrc.yml +COPY --from=build /app/.yarn/ /app/.yarn/ RUN yarn workspaces focus --production @apollo-annotation/collaboration-server + EXPOSE 3999 CMD ["yarn", "start:prod"]