Skip to content

Commit 4f2dc40

Browse files
committed
build: Trying to fix the release process.
1 parent c9938c8 commit 4f2dc40

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

.github/workflows/publish.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Build backend database
1111
runs-on: ubuntu-latest
1212
env:
13-
DATABASE_URL: "postgresql://postgres:postgres@localhost:5555/postgres"
13+
DATABASE_URL: "postgresql://bbm:bbm@localhost:5555/bbm?schema=public"
1414
defaults:
1515
run:
1616
working-directory: libs/database
@@ -25,17 +25,27 @@ jobs:
2525
- name: Start database
2626
run: |
2727
docker run -d \
28-
--name my-db \
28+
--name bbm-database \
2929
-p 5555:5432 \
3030
-e PGDATA=/data \
31-
-e POSTGRES_USER=postgres \
32-
-e POSTGRES_PASSWORD=postgres \
33-
-e POSTGRES_DB=postgres \
34-
postgres:16
31+
-e POSTGRES_USER=bbm \
32+
-e POSTGRES_PASSWORD=bbm \
33+
-e POSTGRES_DB=bbm \
34+
postgres:18-trixie
35+
- name: Set up Node.js
36+
uses: actions/setup-node@v6
37+
with:
38+
node-version: 24
39+
- name: Install dependencies
40+
run: npm ci
41+
- name: Init DB with prisma and automatically seed
42+
run: npm run schema-generate
43+
- name: Init DB with prisma and automatically seed
44+
run: npm run schema-migrate
3545
- name: Init DB with prisma and automatically seed
36-
run: npx prisma migrate dev --name init
46+
run: npm run database-seed
3747
- name: Commit current state of the container
38-
run: docker commit my-db daemontus/bbm-database:latest
48+
run: docker commit bbm-database daemontus/bbm-database:latest
3949
- name: Push image
4050
run: docker push daemontus/bbm-database
4151

apps/backend/Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ WORKDIR /usr/bbm-website
44
# Copy importable lib projects, the target backend, monorepo package.json and package-lock and root tsconfig.json
55
COPY ./libs ./libs
66
COPY ./apps/backend ./apps/backend
7-
COPY ./package*.json ./tsconfig.json ./
7+
COPY ./package*.json ./tsconfig*.json ./
8+
9+
# This is just a dummy URL for generating prisma schema; it won't be used in production
10+
ENV DATABASE_URL="postgres://postgres:postgres@localhost:5432/postgres"
811

912
# Install dependencies with npm clean install
1013
RUN npm ci
1114

12-
# Generate database types
13-
RUN npm run generate -w database
15+
# Generate database client
16+
RUN npm run schema-generate
17+
RUN npm run build -w ./libs/database
1418

1519
# Build backend
16-
RUN npm run build -w backend
20+
RUN npm run build -w ./apps/backend
1721

1822
################################
1923
FROM node:22-alpine AS runner
@@ -29,7 +33,7 @@ COPY --from=builder /usr/bbm-website/apps/backend/package.json ./apps/backend/p
2933
COPY --from=builder /usr/bbm-website/apps/backend/dist ./
3034

3135
# Copy generated db js files
32-
COPY --from=builder /usr/bbm-website/libs/database/src/generated ./libs/database/src/generated/
36+
COPY --from=builder /usr/bbm-website/libs/database ./libs/database
3337

3438
# Debug print to see if the repo structure fits
3539
RUN tree .
@@ -42,4 +46,4 @@ RUN ls -a node_modules
4246

4347
EXPOSE 3000
4448

45-
CMD ["node", "-r", "tsconfig-paths/register", "apps/backend/src/index.js"]
49+
CMD ["node", "index.js"]

apps/frontend/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,30 @@ WORKDIR /usr/bbm-website
44
# Copy importable lib projects, the target frontend, monorepo package.json and package-lock and root tsconfig.json
55
COPY ./libs ./libs
66
COPY ./apps/frontend ./apps/frontend
7-
COPY ./package*.json ./tsconfig.json ./
7+
COPY ./package*.json ./tsconfig*.json ./
88

99
# Copy backend tsconfig to shutup resolving paths warning in later build step
1010
COPY ./apps/backend/tsconfig.json ./apps/backend/
1111

12+
# This is just a dummy URL for generating prisma schema; it won't be used in production
13+
ENV DATABASE_URL="postgres://postgres:postgres@localhost:5432/postgres"
14+
1215
# Install dependencies with npm clean install
1316
RUN npm ci
1417

1518
# Generate database types
16-
RUN npm run generate -w database
19+
RUN npm run schema-generate
1720

1821
# Build frontend
19-
RUN npm run build -w frontend
22+
RUN npm run build -w ./apps/frontend
2023

2124
##############################
2225
FROM nginx:1-alpine AS runner
2326

27+
# Install bash
28+
RUN apk update
29+
RUN apk add --no-cache bash
30+
2431
COPY --from=builder /usr/bbm-website/apps/frontend/dist /www
2532

2633
COPY apps/frontend/nginx.conf /etc/nginx/nginx.conf

0 commit comments

Comments
 (0)