Skip to content

Commit 266c711

Browse files
committed
Test
1 parent 5b329ea commit 266c711

File tree

3 files changed

+39
-14
lines changed

3 files changed

+39
-14
lines changed

.github/workflows/docker-image.yml

+26-10
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,25 @@ jobs:
3535
id: version
3636
run: |
3737
VERSION=${GITHUB_REF#refs/tags/v}
38-
echo "VERSION=1.2" >> $GITHUB_ENV
38+
echo "VERSION=1.2.1" >> $GITHUB_ENV
3939
echo "MAJOR=1" >> $GITHUB_ENV
4040
echo "MINOR=2" >> $GITHUB_ENV
4141
42-
- name: Build and Push Docker Image with Multiple Tags and Architectures
42+
- name: Build Docker Image (Without Pushing)
4343
uses: docker/build-push-action@v4
4444
with:
4545
context: .
4646
push: false
47-
platforms: linux/amd64,linux/arm64 # Specify both amd64 and arm64
48-
tags: |
49-
jonathanschad/react-nestjs-boilerplate:${{ env.VERSION }}
50-
jonathanschad/react-nestjs-boilerplate:${{ env.MAJOR }}
51-
jonathanschad/react-nestjs-boilerplate:${{ env.MINOR }}
52-
jonathanschad/react-nestjs-boilerplate:latest
47+
load: true # Required to use docker cp in the next step
48+
platforms: linux/amd64 # Only use a single platform for local extraction
49+
tags: temp-build
50+
51+
- name: Copy Sourcemaps from Container
52+
run: |
53+
CONTAINER_ID=$(docker create temp-build)
54+
docker cp $CONTAINER_ID:/app/sourcemaps-server ./sourcemaps-server
55+
docker cp $CONTAINER_ID:/app/sourcemaps-client ./sourcemaps-client
56+
docker rm $CONTAINER_ID
5357
5458
- name: Upload backend sourcemaps to Sentry
5559
env:
@@ -67,7 +71,7 @@ jobs:
6771
sentry-cli releases new "$RELEASE"
6872
6973
# Upload server sourcemaps
70-
sentry-cli releases files "$RELEASE" upload-sourcemaps /sourcemaps-server \
74+
sentry-cli releases files "$RELEASE" upload-sourcemaps ./sourcemaps-server \
7175
--rewrite --url-prefix "~/assets" --validate
7276
7377
# Finalize the release
@@ -86,8 +90,20 @@ jobs:
8690
sentry-cli releases new "$RELEASE"
8791
8892
# Upload client sourcemaps
89-
sentry-cli releases files "$RELEASE" upload-sourcemaps /sourcemaps-client \
93+
sentry-cli releases files "$RELEASE" upload-sourcemaps ./sourcemaps-client \
9094
--rewrite --url-prefix "~/assets" --validate
9195
9296
# Finalize the release
9397
sentry-cli releases finalize "$RELEASE"
98+
99+
- name: Push Docker Image
100+
uses: docker/build-push-action@v4
101+
with:
102+
context: .
103+
push: true
104+
platforms: linux/amd64,linux/arm64 # Specify both amd64 and arm64
105+
tags: |
106+
jonathanschad/react-nestjs-boilerplate:${{ env.VERSION }}
107+
jonathanschad/react-nestjs-boilerplate:${{ env.MAJOR }}
108+
jonathanschad/react-nestjs-boilerplate:${{ env.MINOR }}
109+
jonathanschad/react-nestjs-boilerplate:latest

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
FROM node:20-alpine3.20 AS client-builder
33
WORKDIR /app
44
COPY client/package.json client/yarn.lock ./
5-
RUN yarn install
65
COPY client ./
6+
RUN yarn install
77
RUN yarn build
88

99
# Copy sourcemaps to a separate directory
@@ -15,8 +15,8 @@ RUN rm dist/assets/*.map
1515
FROM node:20-alpine3.20 AS server-builder
1616
WORKDIR /app
1717
COPY server/package.json server/yarn.lock ./
18-
RUN yarn install
1918
COPY server ./
19+
RUN yarn install
2020
RUN npx prisma generate
2121
RUN yarn build
2222
RUN mkdir -p /sourcemaps
@@ -43,4 +43,4 @@ ENV PORT=3000
4343
EXPOSE 3000
4444

4545
# Start the NestJS server
46-
CMD ["sh", "-c", "npx prisma migrate deploy && node server/main.js"]
46+
CMD ["sh", "-c", "npx prisma migrate deploy && node server/src/main.js"]

server/nest-cli.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@
44
"sourceRoot": "src",
55
"compilerOptions": {
66
"deleteOutDir": true,
7-
"assets": ["**/*.html", "**/*.json", "**/*.png", "**/*.jpg", "**/*.jpeg", "**/*.svg", "**/*.md"],
7+
"tsConfigPath": "tsconfig.build.json",
8+
"assets": [
9+
"src/**/*.html",
10+
"src/**/*.json",
11+
"src/**/*.png",
12+
"src/**/*.jpg",
13+
"src/**/*.jpeg",
14+
"src/**/*.svg",
15+
"src/**/*.md"
16+
],
817
"watchAssets": true
918
}
1019
}

0 commit comments

Comments
 (0)