Skip to content

Commit cc8be90

Browse files
authored
Merge pull request #282 from demml/docker-dev
Docker dev
2 parents 58616b4 + 95571e6 commit cc8be90

File tree

313 files changed

+5945
-5279
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

313 files changed

+5945
-5279
lines changed

.github/workflows/build-assets.yml

Lines changed: 65 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
push:
99
branches:
1010
- main
11+
pull_request:
1112
release:
1213
types: [published]
1314

@@ -22,7 +23,7 @@ jobs:
2223
fail-fast: false
2324
matrix:
2425
include:
25-
- os: ubuntu-22.04
26+
- os: ubuntu-22.04 #
2627
target: x86_64-unknown-linux-gnu
2728
archive: tar.gz
2829
binary_name: opsml-server
@@ -34,12 +35,6 @@ jobs:
3435
binary_name: opsml-server
3536
archive_name: opsml-server-aarch64-linux-gnu
3637

37-
- os: macos-latest
38-
target: aarch64-apple-darwin
39-
archive: zip
40-
binary_name: opsml-server
41-
archive_name: opsml-server-aarch64-darwin
42-
4338
- os: macos-13
4439
target: x86_64-apple-darwin
4540
archive: zip
@@ -78,19 +73,23 @@ jobs:
7873
with:
7974
python-version: ${{ env.INTERPRETER }}
8075

81-
- name: Install UI dependencies
82-
run: |
83-
make install.ui.deps
84-
make build.ui
85-
8676
- name: Update apt repositories (Linux)
8777
if: contains(matrix.os, 'ubuntu')
8878
run: |
8979
sudo apt-get update -y
9080
sudo apt-get install -y build-essential
9181
82+
- name: Install UI dependencies
83+
run: |
84+
# install all deps and build UI
85+
make build.ui
86+
87+
# remove node_modules and rebuild prod version to reduce size
88+
make install.ui.deps.prod
89+
9290
- name: Build Binaries
93-
run: cargo build -p opsml-server --release --target ${{ matrix.target }}
91+
run: |
92+
cargo build -p opsml-server --release --target ${{ matrix.target }}
9493
9594
- name: Prepare binary directory
9695
shell: bash
@@ -102,6 +101,12 @@ jobs:
102101
cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} release-bin/
103102
chmod +x release-bin/${{ matrix.binary_name }}
104103
fi
104+
# Copy UI build for Docker builds
105+
if [ "${{ matrix.target }}" == "x86_64-unknown-linux-gnu" ] || [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then
106+
mkdir -p release-bin/ui
107+
cp -r crates/opsml_server/opsml_ui/build release-bin/ui/build || true
108+
cp -r crates/opsml_server/opsml_ui/node_modules release-bin/ui/node_modules || true
109+
fi
105110
106111
- name: Create zip archive (Windows/macOS)
107112
if: contains(matrix.archive, 'zip')
@@ -128,6 +133,28 @@ jobs:
128133
path: ${{ matrix.archive_name }}.${{ matrix.archive }}
129134
retention-days: 1
130135

136+
- name: Package UI for Node.js distribution
137+
if: matrix.target == 'x86_64-unknown-linux-gnu'
138+
shell: bash
139+
run: |
140+
mkdir -p packaged-ui
141+
cp -r crates/opsml_server/opsml_ui/build packaged-ui/build
142+
cp -r crates/opsml_server/opsml_ui/node_modules packaged-ui/node_modules
143+
cp crates/opsml_server/opsml_ui/package.json packaged-ui/
144+
cp crates/opsml_server/opsml_ui/pnpm-lock.yaml packaged-ui/ || true
145+
cd packaged-ui
146+
zip -r ../opsml-ui-node.zip ./*
147+
148+
# only want to run this once, so only on the first matrix item
149+
# The artifact will be the same on all builds regardless of target
150+
- name: Upload UI Node.js package artifact
151+
if: matrix.target == 'x86_64-unknown-linux-gnu'
152+
uses: actions/upload-artifact@v4
153+
with:
154+
name: opsml-ui-node
155+
path: opsml-ui-node.zip
156+
retention-days: 1
157+
131158
publish-docker-images:
132159
if: github.event_name == 'release'
133160
needs: build
@@ -140,14 +167,13 @@ jobs:
140167
include:
141168
- image: "ubuntu"
142169
tag_suffix: "ubuntu"
143-
- image: "alpine"
144-
tag_suffix: "alpine"
145-
- image: "scratch"
146-
tag_suffix: "scratch"
170+
artifact: "opsml-server-x86_64-linux-gnu"
147171
- image: "debian"
148172
tag_suffix: "debian"
149-
- image: "distroless"
150-
tag_suffix: "distroless"
173+
artifact: "opsml-server-x86_64-linux-gnu"
174+
- image: "rocky"
175+
tag_suffix: "rocky-minimal"
176+
artifact: "opsml-server-x86_64-linux-gnu"
151177

152178
steps:
153179
- name: Checkout Code
@@ -164,12 +190,15 @@ jobs:
164190

165191
- name: Extract binary
166192
run: |
167-
mkdir -p binary
168-
tar -xzf ./artifacts/opsml-server-x86_64-linux-gnu.tar.gz -C ./binary
169-
170-
- name: Set up binary permissions
171-
run: |
172-
chmod +x ./binary/opsml-server
193+
archive="./artifacts/${{ matrix.artifact }}.tar.gz"
194+
if [ -f "$archive" ]; then
195+
mkdir -p binary
196+
tar -xzf "$archive" -C ./binary
197+
chmod +x ./binary/opsml-server
198+
else
199+
echo "x86_64 binary $archive not found, skipping this build"
200+
exit 1
201+
fi
173202
174203
- name: Set version tag
175204
id: set-version
@@ -193,7 +222,7 @@ jobs:
193222
file: docker/official/${{ matrix.image }}/Dockerfile
194223
push: true
195224
build-args: |
196-
OPSML_SERVER_BINARY=./binary/opsml-server
225+
OPSML_SERVER_BINARY=./binary
197226
tags: |
198227
demml/opsml:${{ matrix.tag_suffix }}-amd64-${{ steps.set-version.outputs.VERSION }}
199228
${{ github.event_name == 'release' && format('demml/opsml:{0}-amd64-latest', matrix.tag_suffix) || '' }}
@@ -212,14 +241,13 @@ jobs:
212241
include:
213242
- image: "ubuntu"
214243
tag_suffix: "ubuntu"
215-
- image: "alpine"
216-
tag_suffix: "alpine"
217-
- image: "scratch"
218-
tag_suffix: "scratch"
244+
artifact: "opsml-server-aarch64-linux-gnu"
219245
- image: "debian"
220246
tag_suffix: "debian"
221-
- image: "distroless"
222-
tag_suffix: "distroless"
247+
artifact: "opsml-server-aarch64-linux-gnu"
248+
- image: "rocky"
249+
tag_suffix: "rocky-minimal"
250+
artifact: "opsml-server-aarch64-linux-gnu"
223251

224252
steps:
225253
- name: Checkout Code
@@ -239,15 +267,15 @@ jobs:
239267

240268
- name: Extract binary
241269
run: |
242-
if [ -f "./artifacts/opsml-server-aarch64-linux-gnu.tar.gz" ]; then
270+
archive="./artifacts/${{ matrix.artifact }}.tar.gz"
271+
if [ -f "$archive" ]; then
243272
mkdir -p binary
244-
tar -xzf ./artifacts/opsml-server-aarch64-linux-gnu.tar.gz -C ./binary
273+
tar -xzf "$archive" -C ./binary
245274
chmod +x ./binary/opsml-server
246275
else
247-
echo "ARM64 binary not found, skipping this build"
276+
echo "ARM64 binary $archive not found, skipping this build"
248277
exit 1
249278
fi
250-
continue-on-error: true
251279
252280
- name: Set version tag
253281
id: set-version
@@ -272,7 +300,7 @@ jobs:
272300
push: true
273301
platforms: linux/arm64
274302
build-args: |
275-
OPSML_SERVER_BINARY=./binary/opsml-server
303+
OPSML_SERVER_BINARY=./binary
276304
tags: |
277305
demml/opsml:${{ matrix.tag_suffix }}-arm64-${{ steps.set-version.outputs.VERSION }}
278306
${{ github.event_name == 'release' && format('demml/opsml:{0}-arm64-latest', matrix.tag_suffix) || '' }}

Cargo.lock

Lines changed: 0 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ rand = { version = "0.9.1"}
8989
rayon = "1.*"
9090
regex = "1.*"
9191
reqwest = { version = "0.12.*", features = ["json", "stream", "multipart", "rustls-tls", "rustls-tls-native-roots", "blocking" ], default-features = false }
92-
rust-embed = "8.*"
9392
reqwest-middleware = "0.*"
9493
rusty-logging = "0.*"
9594
# we cant use crates.io because scouter relies on a fork of linfa at the moment

Makefile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,17 @@ ui.update.deps:
121121
install.ui.deps:
122122
cd $(UI_DIR) && pnpm install
123123

124-
.PHONY: ui.build
124+
.PHONY: ui.install.deps.prod
125+
install.ui.deps.prod:
126+
# remove existing node_modules
127+
rm -rf $(UI_DIR)/node_modules
128+
# install only production dependencies
129+
cd $(UI_DIR) && pnpm install --prod
130+
131+
.PHONY: build.ui
125132
build.ui:
126133
cd $(UI_DIR) && pnpm install
127134
cd $(UI_DIR) && pnpm build
128-
touch $(UI_DIR)/site/.gitkeep # to make sure the site folder is not ignored by git
129135

130136
ui.dev:
131137
cd $(UI_DIR) && pnpm run dev
@@ -154,7 +160,7 @@ dev.frontend:
154160

155161
.PHONY: build.backend
156162
build.backend:
157-
cargo build --release -p opsml-server
163+
cargo build -p opsml-server --target
158164

159165
.PHONY: start.backend
160166
start.backend: build.backend
@@ -176,9 +182,9 @@ start.both:
176182
@echo "Starting both servers in production mode..."
177183
@echo "Backend API: http://localhost:8080"
178184
@echo "Frontend SSR: http://localhost:3000"
179-
@make -j2 start.backend start.frontend
185+
@make -j2 dev.backend start.frontend
180186

181187
.PHONY: stop.both
182188
stop.both:
183189
-lsof -ti:3000 | xargs kill -9 2>/dev/null || true
184-
-lsof -ti:8080 | xargs kill -9 2>/dev/null || true
190+
-lsof -ti:8080 | xargs kill -9 2>/dev/null || true

crates/opsml_cli/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ flate2 = "1.*"
4040
tar = "*"
4141

4242

43+
44+
4345
[dev-dependencies]
4446
mockall = { workspace = true }
4547
mockito = { workspace = true }

0 commit comments

Comments
 (0)