-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-scripts.js
48 lines (46 loc) · 1.99 KB
/
package-scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const { concurrent, series } = require("nps-utils");
const backendPackage = require("./apps/backend/package.json");
const frontendPackage = require("./apps/frontend/package.json");
require("dotenv").config();
const backendVersion = backendPackage.version;
const frontendVersion = frontendPackage.version;
module.exports = {
scripts: {
prepare: {
description: "This sets up the project folder with dependencies and services",
default: series.nps("prepare.frontend", "prepare.backend"),
frontend: "pnpm install",
backend: "docker-compose -f apps/backend/docker-compose.yml up -d",
},
docker: {
description: "Manages docker related backend services",
default: series.nps("docker.backend.build", "docker.frontend.build", "docker.nginx.build"),
backend: {
up: "docker-compose -f apps/backend/docker-compose.yml up -d",
down: "docker-compose -f apps/backend/docker-compose.yml down",
build: `docker build -f apps/backend/Dockerfile -t stiforr/hfs-backend:${backendVersion} -t stiforr/hfs-backend:latest .`,
},
frontend: {
build: `docker build -f apps/frontend/Dockerfile --secret id=mysecret,src=.env -t stiforr/hfs-frontend:${frontendVersion} -t stiforr/hfs-frontend:latest .`,
},
nginx: {
build: `docker build -f docker/nginx/Dockerfile -t stiforr/hfs-proxy docker/nginx/.`,
},
},
dev: {
description: "Starts the dev environment",
default: "yarn dev",
},
down: {
description: "Destroys backend services",
default: concurrent.nps("docker.backend.down"),
},
clean: {
description: "Remove dev and build outputs from all projects",
default: series.nps("clean.buildArtifacts", "clean.nodeModules"),
buildArtifacts: "rimraf apps/frontend/.next apps/backend/dist apps/remix/build ",
nodeModules:
"rimraf node_modules apps/frontend/node_modules apps/backend/node_modules apps/remix/node_modules apps/strapi/node_modules",
},
},
};