diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 262729f29..26ac7226b 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -33,4 +33,4 @@ jobs: run: yarn test - name: Build application - run: yarn build:all + run: yarn build:production diff --git a/Dockerfile b/Dockerfile index cdebe275d..928db52ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,7 @@ COPY ./tsconfig.base.json tsconfig.base.json COPY ./libs libs COPY ./apps apps -RUN yarn build:all +RUN yarn build:production # Prepare the dist image with additional node_modules WORKDIR /ghostfolio/dist/apps/api @@ -58,4 +58,4 @@ RUN apt update && apt install -y \ COPY --from=builder /ghostfolio/dist/apps /ghostfolio/apps WORKDIR /ghostfolio/apps/api EXPOSE ${PORT:-3333} -CMD [ "yarn", "start:prod" ] +CMD [ "yarn", "start:production" ] diff --git a/README.md b/README.md index d7ce11b12..683f2a31a 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,6 @@ Please follow the instructions of the Ghostfolio [Unraid Community App](https:// ### Setup 1. Run `yarn install` -1. Run `yarn build:dev` to build the source code including the assets 1. Run `docker-compose --env-file ./.env -f docker/docker-compose.dev.yml up -d` to start [PostgreSQL](https://www.postgresql.org) and [Redis](https://redis.io) 1. Run `yarn database:setup` to initialize the database schema 1. Start the server and the client (see [_Development_](#Development)) diff --git a/apps/client/project.json b/apps/client/project.json index 4a941688b..56369275e 100644 --- a/apps/client/project.json +++ b/apps/client/project.json @@ -10,11 +10,13 @@ "sourceRoot": "apps/client/src", "prefix": "gf", "targets": { - "build": { + "copy-assets": { "executor": "nx:run-commands", - "dependsOn": ["build-base"], "options": { "commands": [ + { + "command": "mkdir -p dist/apps/client" + }, { "command": "cp -r apps/client/src/assets dist/apps/client" }, @@ -48,7 +50,7 @@ ] } }, - "build-base": { + "build": { "executor": "@nx/angular:webpack-browser", "options": { "localize": true, diff --git a/package.json b/package.json index d0b80a70c..6acc5ef9f 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "affected:lint": "nx affected:lint", "affected:test": "nx affected:test", "angular": "node --max_old_space_size=32768 ./node_modules/@angular/cli/bin/ng", - "build:all": "nx run api:build:production && nx run client:build:production && yarn replace-placeholders-in-build", - "build:dev": "nx run api:build && nx run client:build && yarn replace-placeholders-in-build", + "build:dev": "nx run api:build && nx run client:build && nx run client:copy-assets && yarn replace-placeholders-in-build", + "build:production": "nx run api:build:production && nx run client:build:production && nx run client:copy-assets && yarn replace-placeholders-in-build", "build:storybook": "nx run ui:build-storybook", "database:format-schema": "prisma format", "database:generate-typings": "prisma generate", @@ -39,8 +39,8 @@ "postinstall": "prisma generate", "replace-placeholders-in-build": "node ./replace.build.js", "start": "node dist/apps/api/main", - "start:client": "nx run client:serve --configuration=development-en --hmr -o", - "start:prod": "yarn database:migrate && yarn database:seed && node main", + "start:client": "nx run client:copy-assets && nx run client:serve --configuration=development-en --hmr -o", + "start:production": "yarn database:migrate && yarn database:seed && node main", "start:server": "nx run api:serve --watch", "start:storybook": "nx run ui:storybook", "test": "npx dotenv-cli -e .env.example -- nx test",