Skip to content

Commit

Permalink
switching to yarn workspaces focus for production dependencies 🔱
Browse files Browse the repository at this point in the history
  • Loading branch information
dysbulic committed Jul 16, 2024
1 parent 7193bbf commit 6b511b1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docker/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN yarn backend:build
# Delete devDependencies
RUN corepack enable
RUN yarn set version berry
RUN yarn install --production # --immutable
RUN yarn workspaces focus @metafam/backend --production # --immutable
# RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

# Create completely new stage including only necessary files
Expand Down
20 changes: 13 additions & 7 deletions docker/discord-bot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-slim as base
FROM node:20-slim AS base
WORKDIR /usr/src/app

# Install dependencies not included in the slim image
Expand All @@ -15,10 +15,13 @@ COPY tsconfig.base.json .
COPY packages/discord-bot/*.json ./packages/discord-bot/
COPY packages/utils/*.json ./packages/utils/

RUN yarn install --pure-lockfile
RUN corepack enable
RUN yarn set version berry
RUN yarn config set nodeLinker node-modules
RUN yarn install # --immutable

# Dev environment doesn't run this stage or beyond
FROM base as build
FROM base AS build

# Copy source files
COPY packages/discord-bot ./packages/discord-bot/
Expand All @@ -28,14 +31,17 @@ COPY packages/@types ./packages/@types/
# Set env vars
ARG GRAPHQL_HOST

ENV GRAPHQL_URL https://$GRAPHQL_HOST.onrender.com/v1/graphql
ENV HASURA_GRAPHQL_ADMIN_SECRET metagame_secret
ENV GRAPHQL_URL=https://$GRAPHQL_HOST.onrender.com/v1/graphql
ENV HASURA_GRAPHQL_ADMIN_SECRET=metagame_secret

# Build
RUN yarn discord-bot build

# Delete devDependencies
RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline
RUN corepack enable
RUN yarn set version berry
RUN yarn config set nodeLinker node-modules
RUN yarn workspaces focus @metafam/discord-bot --production # --immutable
# RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

# Create completely new stage including only necessary files
FROM node:20-slim as app
Expand Down
9 changes: 7 additions & 2 deletions docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ COPY packages/design-system/*.json ./packages/design-system/

RUN corepack enable
RUN yarn set version berry
RUN yarn config set nodeLinker node-modules
RUN yarn install # --immutable

FROM base AS build
Expand Down Expand Up @@ -87,8 +88,12 @@ ENV GCAL_CLIENT_EMAIL=$GCAL_CLIENT_EMAIL
ENV GCAL_PROJECT_NUMBER=$GCAL_PROJECT_NUMBER

ONBUILD RUN yarn web:build
# Delete devDependencies
ONBUILD RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

ONBUILD RUN corepack enable
ONBUILD RUN yarn set version berry
ONBUILD RUN yarn config set nodeLinker node-modules
ONBUILD RUN yarn workspaces focus @metafam/web --production # --immutable
# ONBUILD RUN yarn install --pure-lockfile --production --ignore-scripts --prefer-offline

FROM build AS build-development
ONBUILD RUN yarn web:deps:build
Expand Down

0 comments on commit 6b511b1

Please sign in to comment.