Skip to content

Commit c24fd95

Browse files
committed
CI/CD prep
1 parent a9a634d commit c24fd95

File tree

5 files changed

+42
-1
lines changed

5 files changed

+42
-1
lines changed

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM node:22.13.1-alpine
4+
5+
RUN apk add --no-cache bash
6+
RUN apk update
7+
8+
ARG RESET_DB_ARG=false
9+
ENV RESET_DB=$RESET_DB_ARG
10+
ARG SEED_DATA_ARG=""
11+
ENV SEED_DATA=$SEED_DATA_ARG
12+
ENV PRISMA_CLI_BINARY_TARGETS=linux-musl-openssl-3.0.x
13+
14+
WORKDIR /app
15+
COPY . .
16+
RUN npm install pnpm -g
17+
RUN pnpm install
18+
RUN pnpm run build
19+
RUN chmod +x appStartUp.sh
20+
CMD ./appStartUp.sh

appStartUp.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
export DATABASE_URL=$(echo -e ${DATABASE_URL})
5+
6+
echo "Database - running migrations."
7+
if $RESET_DB; then
8+
echo "Resetting DB"
9+
npx prisma migrate reset --force
10+
else
11+
echo "Running migrations"
12+
npx prisma migrate deploy
13+
fi
14+
15+
# Start the app
16+
pnpm start:prod

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
docker buildx build --no-cache=true --build-arg RESET_DB_ARG=<<pipeline.parameters.reset-db>> --build-arg SEED_DATA_ARG=${DEPLOYMENT_ENVIRONMENT} -t ${APPNAME}}:latest .

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"test:watch": "jest --watch",
1818
"test:cov": "jest --coverage",
1919
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20-
"test:e2e": "jest --config ./test/jest-e2e.json"
20+
"test:e2e": "jest --config ./test/jest-e2e.json",
21+
"postinstall": "npx prisma generate"
2122
},
2223
"dependencies": {
2324
"@nestjs/common": "^11.0.1",

prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
generator client {
22
provider = "prisma-client-js"
33
previewFeatures = ["extendedIndexes"]
4+
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
45
}
56

67
datasource db {

0 commit comments

Comments
 (0)