Skip to content

Commit

Permalink
fix: Tweak docker build
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswk committed Jun 7, 2024
1 parent f8abfee commit d69d826
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
!README.md
!frontend
frontend/node_modules
!.yarn/**
!.yarnrc.yml
!frontend/.yarn/**
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ RUN corepack enable
RUN yarn install --immutable && yarn prepare:backend && yarn local:package

# frontend/build should already exist (it needs to be built in the local filesystem but in case of a fresh build we'll build it here)
RUN yarn build:frontend
RUN yarn build:frontend:if-needed

RUN mkdir -p /unleash/build/frontend && mv /unleash/frontend/build /unleash/build/frontend/build

WORKDIR /unleash/docker

RUN yarn install
RUN yarn workspaces focus -A --production

FROM node:$NODE_VERSION

Expand Down
Binary file modified frontend/.yarn/install-state.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"copy-templates": "copyfiles -u 1 src/mailtemplates/**/*.mustache dist/",
"build:backend": "tsc --pretty --strictNullChecks false",
"build:frontend": "yarn --cwd ./frontend run build",
"build:frontend:if-needed": "if [ ! -d ./frontend/build ]; then yarn install --cwd ./frontend --frozen-lockfile && yarn build:frontend; fi",
"build:frontend:if-needed": "./scripts/build-frontend-if-needed.sh",
"build": "yarn run clean && concurrently \"yarn:copy-templates\" \"yarn:build:frontend\" \"yarn:build:backend\"",
"dev:backend": "TZ=UTC NODE_ENV=development tsc-watch --strictNullChecks false --onSuccess \"node dist/server-dev.js\"",
"dev:frontend": "wait-on tcp:4242 && yarn --cwd ./frontend run dev",
Expand Down
4 changes: 4 additions & 0 deletions scripts/build-frontend-if-needed.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
if [ ! -d ./frontend/build ]; then
yarn --cwd ./frontend install --immutable && yarn build:frontend;
fi

0 comments on commit d69d826

Please sign in to comment.