Skip to content

Commit b39aac5

Browse files
committed
fix(ci): build frontend on release ci (#2927)
Fixes RVT-5155
1 parent e52f17c commit b39aac5

File tree

7 files changed

+122
-10
lines changed

7 files changed

+122
-10
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ jobs:
191191
file: docker/universal/Dockerfile
192192
target: engine-full
193193
platforms: ${{ matrix.platform }}
194+
build-args: |
195+
BUILD_FRONTEND=true
194196
# secrets: |
195197
# fontawesome_package_token=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}
196198
# secret-files: |
@@ -205,6 +207,8 @@ jobs:
205207
file: docker/universal/Dockerfile
206208
target: engine-slim
207209
platforms: ${{ matrix.platform }}
210+
build-args: |
211+
BUILD_FRONTEND=true
208212
# secrets: |
209213
# fontawesome_package_token=${{ secrets.FONTAWESOME_PACKAGE_TOKEN }}
210214
# secret-files: |

docker/engine/linux-aarch64.Dockerfile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# syntax=docker/dockerfile:1.4
22
FROM rust:1.88.0 AS base
3+
4+
ARG BUILD_FRONTEND=true
5+
ARG VITE_APP_API_URL
6+
37
# Install dependencies
48
RUN apt-get update && apt-get install -y \
59
musl-tools \
@@ -13,12 +17,19 @@ RUN apt-get update && apt-get install -y \
1317
ca-certificates \
1418
g++ \
1519
g++-multilib \
16-
git-lfs && \
20+
git-lfs \
21+
curl && \
22+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
23+
apt-get install -y nodejs && \
24+
corepack enable && \
1725
rm -rf /var/lib/apt/lists/* && \
1826
wget -q https://github.com/cross-tools/musl-cross/releases/download/20250815/aarch64-unknown-linux-musl.tar.xz && \
1927
tar -xzf aarch64-unknown-linux-musl.tgz -C /opt/ && \
2028
rm aarch64-unknown-linux-musl.tgz
2129

30+
# Disable interactive prompt
31+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
32+
2233
# Install musl targets
2334
RUN rustup target add aarch64-unknown-linux-musl
2435

@@ -60,6 +71,17 @@ ENV OPENSSL_DIR=/musl-aarch64 \
6071
# Copy the source code
6172
COPY . .
6273

74+
# Build frontend
75+
RUN if [ "$BUILD_FRONTEND" = "true" ]; then \
76+
(cd sdks/typescript/api-full && pnpm install && pnpm run build) && \
77+
(cd frontend && pnpm install && \
78+
if [ -n "$VITE_APP_API_URL" ]; then \
79+
VITE_APP_API_URL="${VITE_APP_API_URL}" pnpm run build:engine; \
80+
else \
81+
pnpm run build:engine; \
82+
fi); \
83+
fi
84+
6385
# Build for Linux with musl (static binary) - aarch64
6486
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6587
--mount=type=cache,target=/usr/local/cargo/git \

docker/engine/linux-x86_64.Dockerfile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# syntax=docker/dockerfile:1.4
22
FROM rust:1.88.0 AS base
33

4+
ARG BUILD_FRONTEND=true
5+
ARG VITE_APP_API_URL
6+
47
# Install dependencies
58
RUN apt-get update && apt-get install -y \
69
musl-tools \
@@ -14,12 +17,19 @@ RUN apt-get update && apt-get install -y \
1417
ca-certificates \
1518
g++ \
1619
g++-multilib \
17-
git-lfs && \
20+
git-lfs \
21+
curl && \
22+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
23+
apt-get install -y nodejs && \
24+
corepack enable && \
1825
rm -rf /var/lib/apt/lists/* && \
1926
wget -q https://github.com/cross-tools/musl-cross/releases/latest/download/x86_64-unknown-linux-musl.tar.xz && \
2027
tar -xf x86_64-unknown-linux-musl.tar.xz -C /opt/ && \
2128
rm x86_64-unknown-linux-musl.tar.xz
2229

30+
# Disable interactive prompt
31+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
32+
2333
# Install musl targets
2434
RUN rustup target add x86_64-unknown-linux-musl
2535

@@ -61,6 +71,17 @@ ENV OPENSSL_DIR=/musl \
6171
# Copy the source code
6272
COPY . .
6373

74+
# Build frontend
75+
RUN if [ "$BUILD_FRONTEND" = "true" ]; then \
76+
(cd sdks/typescript/api-full && pnpm install && pnpm run build) && \
77+
(cd frontend && pnpm install && \
78+
if [ -n "$VITE_APP_API_URL" ]; then \
79+
VITE_APP_API_URL="${VITE_APP_API_URL}" pnpm run build:engine; \
80+
else \
81+
pnpm run build:engine; \
82+
fi); \
83+
fi
84+
6485
# Build for Linux with musl (static binary) - x86_64
6586
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6687
--mount=type=cache,target=/usr/local/cargo/git \

docker/engine/macos-aarch64.Dockerfile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# syntax=docker/dockerfile:1.4
22
FROM rust:1.88.0 AS base
33

4+
ARG BUILD_FRONTEND=true
5+
ARG VITE_APP_API_URL
6+
47
# Install dependencies
58
RUN apt-get update && apt-get install -y \
69
git-lfs \
@@ -11,8 +14,11 @@ RUN apt-get update && apt-get install -y \
1114
libxml2-dev \
1215
wget \
1316
xz-utils \
14-
curl \
15-
&& rm -rf /var/lib/apt/lists/*
17+
curl && \
18+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
19+
apt-get install -y nodejs && \
20+
corepack enable && \
21+
rm -rf /var/lib/apt/lists/*
1622

1723
# Install osxcross
1824
RUN git config --global --add safe.directory '*' && \
@@ -25,6 +31,9 @@ RUN git config --global --add safe.directory '*' && \
2531
# Add osxcross to PATH
2632
ENV PATH="/root/osxcross/target/bin:$PATH"
2733

34+
# Disable interactive prompt
35+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
36+
2837
# Tell Clang/bindgen to use the macOS SDK, and nudge Clang to prefer osxcross binutils.
2938
ENV OSXCROSS_SDK=MacOSX11.3.sdk \
3039
SDKROOT=/root/osxcross/target/SDK/MacOSX11.3.sdk \
@@ -61,6 +70,17 @@ ar = "aarch64-apple-darwin20.4-ar"\n\
6170
# Copy the source code
6271
COPY . .
6372

73+
# Build frontend
74+
RUN if [ "$BUILD_FRONTEND" = "true" ]; then \
75+
(cd sdks/typescript/api-full && pnpm install && pnpm run build) && \
76+
(cd frontend && pnpm install && \
77+
if [ -n "$VITE_APP_API_URL" ]; then \
78+
VITE_APP_API_URL="${VITE_APP_API_URL}" pnpm run build:engine; \
79+
else \
80+
pnpm run build:engine; \
81+
fi); \
82+
fi
83+
6484
# Build for ARM64 macOS
6585
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6686
--mount=type=cache,target=/usr/local/cargo/git \

docker/engine/macos-x86_64.Dockerfile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# syntax=docker/dockerfile:1.4
22
FROM rust:1.88.0 AS base
33

4+
ARG BUILD_FRONTEND=true
5+
ARG VITE_APP_API_URL
6+
47
# Install dependencies
58
RUN apt-get update && apt-get install -y \
69
git-lfs \
@@ -11,8 +14,11 @@ RUN apt-get update && apt-get install -y \
1114
libxml2-dev \
1215
wget \
1316
xz-utils \
14-
curl \
15-
&& rm -rf /var/lib/apt/lists/*
17+
curl && \
18+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
19+
apt-get install -y nodejs && \
20+
corepack enable && \
21+
rm -rf /var/lib/apt/lists/*
1622

1723
# Install osxcross
1824
RUN git config --global --add safe.directory '*' && \
@@ -25,6 +31,9 @@ RUN git config --global --add safe.directory '*' && \
2531
# Add osxcross to PATH
2632
ENV PATH="/root/osxcross/target/bin:$PATH"
2733

34+
# Disable interactive prompt
35+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
36+
2837
# Tell Clang/bindgen to use the macOS SDK, and nudge Clang to prefer osxcross binutils.
2938
ENV OSXCROSS_SDK=MacOSX11.3.sdk \
3039
SDKROOT=/root/osxcross/target/SDK/MacOSX11.3.sdk \
@@ -61,6 +70,17 @@ ar = "x86_64-apple-darwin20.4-ar"\n\
6170
# Copy the source code
6271
COPY . .
6372

73+
# Build frontend
74+
RUN if [ "$BUILD_FRONTEND" = "true" ]; then \
75+
(cd sdks/typescript/api-full && pnpm install && pnpm run build) && \
76+
(cd frontend && pnpm install && \
77+
if [ -n "$VITE_APP_API_URL" ]; then \
78+
VITE_APP_API_URL="${VITE_APP_API_URL}" pnpm run build:engine; \
79+
else \
80+
pnpm run build:engine; \
81+
fi); \
82+
fi
83+
6484
# Build for x86_64 macOS
6585
RUN --mount=type=cache,target=/usr/local/cargo/registry \
6686
--mount=type=cache,target=/usr/local/cargo/git \

docker/engine/windows.Dockerfile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# syntax=docker/dockerfile:1.4
22
FROM rust:1.88.0
33

4+
ARG BUILD_FRONTEND=true
5+
ARG VITE_APP_API_URL
6+
47
# Install dependencies
58
RUN apt-get update && apt-get install -y \
69
llvm-14-dev \
@@ -12,12 +15,19 @@ RUN apt-get update && apt-get install -y \
1215
g++-mingw-w64-x86-64 \
1316
binutils-mingw-w64-x86-64 \
1417
ca-certificates \
15-
&& rm -rf /var/lib/apt/lists/*
18+
curl && \
19+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
20+
apt-get install -y nodejs && \
21+
corepack enable && \
22+
rm -rf /var/lib/apt/lists/*
1623

1724
# Switch MinGW-w64 to the POSIX threading model toolchain
1825
RUN update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix && \
1926
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
2027

28+
# Disable interactive prompt
29+
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
30+
2131
# Install target
2232
RUN rustup target add x86_64-pc-windows-gnu
2333

@@ -48,6 +58,17 @@ WORKDIR /build
4858
# Copy the source code
4959
COPY . .
5060

61+
# Build frontend
62+
RUN if [ "$BUILD_FRONTEND" = "true" ]; then \
63+
(cd sdks/typescript/api-full && pnpm install && pnpm run build) && \
64+
(cd frontend && pnpm install && \
65+
if [ -n "$VITE_APP_API_URL" ]; then \
66+
VITE_APP_API_URL="${VITE_APP_API_URL}" pnpm run build:engine; \
67+
else \
68+
pnpm run build:engine; \
69+
fi); \
70+
fi
71+
5172
# Build for Windows
5273
RUN --mount=type=cache,target=/usr/local/cargo/registry \
5374
--mount=type=cache,target=/usr/local/cargo/git \

docker/universal/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ FROM --platform=linux/amd64 rust:1.88.0-bookworm AS builder
88
ARG TARGETARCH
99

1010
ARG BUILD_FRONTEND=false
11+
ARG VITE_APP_API_URL
1112

1213
ENV DEBIAN_FRONTEND=noninteractive
1314
RUN apt-get update -y && \
@@ -38,8 +39,6 @@ RUN apt-get update -y && \
3839
# Disable interactive prompt
3940
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
4041

41-
ENV RIVET_SKIP_BUILD_TS_SDK=1
42-
4342
# Pull via Git CLI to improve reliability in CI
4443
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
4544

@@ -50,7 +49,12 @@ COPY . .
5049
# Build frontend
5150
RUN if [ "$BUILD_FRONTEND" = "true" ]; then \
5251
(cd sdks/typescript/api-full && pnpm install && pnpm run build) && \
53-
(cd frontend && pnpm install && pnpm run build); \
52+
(cd frontend && pnpm install && \
53+
if [ -n "$VITE_APP_API_URL" ]; then \
54+
VITE_APP_API_URL="${VITE_APP_API_URL}" pnpm run build:engine; \
55+
else \
56+
pnpm run build:engine; \
57+
fi); \
5458
fi
5559

5660
# Build and copy all binaries from target directory into an empty image (it is not

0 commit comments

Comments
 (0)