-
Notifications
You must be signed in to change notification settings - Fork 5
Integration Testing #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4cc5d1c
cbc0be1
b032592
92b82b9
03bc931
e931979
b8c2b98
b7c4181
de7942e
71ecefe
bb2d45b
8ad6e4d
8d0ea8e
184f3db
c9a959c
7867529
aaaa05a
55600e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Ignore build artifacts | ||
| target | ||
| # Ignore deployment scripts and configs (unless you need them in the image) | ||
| deploy/ | ||
| Dockerfile | ||
|
|
||
| .dockerignore | ||
| .git | ||
| .gitignore | ||
|
|
||
|
|
||
| # Ignore editor/project files | ||
| *.swp | ||
| *.swo | ||
| *.bak | ||
| *.tmp | ||
| *.log | ||
| .DS_Store | ||
| .idea/ | ||
| .vscode/ | ||
|
|
||
| # Ignore test and coverage outputs | ||
| coverage/ | ||
|
|
||
| # Ignore OS-specific files | ||
| Thumbs.db | ||
| ehthumbs.db |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| FROM rust:1.88-slim-bookworm | ||
|
|
||
| LABEL maintainer="UnifyAir <support@unifyair.com>" | ||
|
|
||
| # Install build dependencies and cargo-chef | ||
| RUN apt-get update && apt-get install -y \ | ||
| pkg-config \ | ||
| libssl-dev \ | ||
| libclang-dev \ | ||
| clang \ | ||
| libsctp-dev | ||
|
|
||
| RUN cargo install cargo-chef | ||
|
|
||
| # Clean apt cache | ||
| RUN apt-get clean | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||||||||||||||||||||||||||||
| FROM debian:bookworm-slim AS executor | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| LABEL maintainer="UnifyAir <support@unifyair.com>" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Install runtime dependencies | ||||||||||||||||||||||||||||||
| RUN apt-get update && apt-get install -y \ | ||||||||||||||||||||||||||||||
| libssl3 \ | ||||||||||||||||||||||||||||||
| ca-certificates \ | ||||||||||||||||||||||||||||||
| libsctp1 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Clean apt cache | ||||||||||||||||||||||||||||||
| RUN apt-get clean | ||||||||||||||||||||||||||||||
|
Comment on lines
+6
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Combine RUN commands to optimize Docker layers The apt-get update, install, and clean commands should be combined into a single RUN instruction to minimize layers and ensure the apt cache is cleaned in the same layer where it's created. -# Install runtime dependencies
-RUN apt-get update && apt-get install -y \
- libssl3 \
- ca-certificates \
- libsctp1
-
-# Clean apt cache
-RUN apt-get clean
+# Install runtime dependencies
+RUN apt-get update && apt-get install -y \
+ libssl3 \
+ ca-certificates \
+ libsctp1 && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Copyright 2021-present Open Networking Foundation | ||
| # Copyright 2024-present Intel Corporation | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
|
|
||
| FROM golang:1.24.4-bookworm AS builder | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get -y install --no-install-recommends \ | ||
| vim \ | ||
| ethtool \ | ||
| git && \ | ||
| apt-get clean | ||
|
|
||
| WORKDIR $GOPATH/src/gnbsim | ||
|
|
||
| ARG VERSION | ||
|
|
||
| # Clone the repository instead of copying context files | ||
| RUN git clone https://github.com/omec-project/gnbsim.git . | ||
| RUN git checkout v$VERSION | ||
| RUN make all | ||
|
Comment on lines
+7
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the caller forgets to pass Provide a sane default and pin depth: -ARG VERSION
+ARG VERSION=1.6.3
@@
-RUN git clone https://github.com/omec-project/gnbsim.git .
-RUN git checkout v$VERSION
+RUN git clone --depth 1 --branch v$VERSION \
+ https://github.com/omec-project/gnbsim.git .🤖 Prompt for AI Agents |
||
|
|
||
| FROM alpine:3.22 AS gnbsim | ||
|
|
||
| LABEL maintainer="UnifyAir <support@unifyair.com>" | ||
|
|
||
| ARG DEBUG_TOOLS | ||
|
|
||
| RUN apk update && apk add --no-cache -U bash tcpdump | ||
|
|
||
| # Install debug tools ~ 50MB (if DEBUG_TOOLS is set to true) | ||
| RUN if [ "$DEBUG_TOOLS" = "true" ]; then \ | ||
| apk update && apk add --no-cache -U gcompat vim strace net-tools curl netcat-openbsd bind-tools; \ | ||
| fi | ||
|
|
||
| WORKDIR /gnbsim | ||
|
|
||
| # Copy executable | ||
| COPY --from=builder /go/src/gnbsim/bin /usr/local/bin/. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # --- Chef base image | ||
| FROM builder-base AS chef | ||
| WORKDIR /unifyair | ||
|
|
||
| # --- Planner stage: generate recipe.json for dependencies | ||
| FROM chef AS planner | ||
| COPY . . | ||
| RUN cargo chef prepare --recipe-path recipe.json | ||
|
|
||
| # --- Builder stage: build dependencies only (cached if Cargo.toml/Cargo.lock unchanged) | ||
| FROM chef AS builder | ||
| COPY --from=planner /unifyair/recipe.json recipe.json | ||
|
|
||
| # TODO: cleanup https://github.com/LukeMathWalker/cargo-chef/issues/271 | ||
| COPY ./rust-toolchain.toml rust-toolchain.toml | ||
| ARG MODE | ||
| RUN if [ "$MODE" = "release" ]; then \ | ||
| cargo chef cook --release --recipe-path recipe.json; \ | ||
| else \ | ||
| cargo chef cook --recipe-path recipe.json; \ | ||
| fi | ||
| # --- Build application | ||
| COPY . . | ||
| ARG MODE | ||
| RUN if [ "$MODE" = "release" ]; then \ | ||
| cargo build --release --package lightning-cli; \ | ||
| else \ | ||
| cargo build --package lightning-cli; \ | ||
| fi | ||
|
|
||
| # --- Runtime stage | ||
| FROM executor-base AS executor | ||
| WORKDIR /unifyair | ||
| RUN mkdir -p /unifyair/config | ||
| ARG MODE | ||
| COPY --from=builder /unifyair/target/$MODE/lightning-cli /unifyair/lightning-cli |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| group "default" { | ||
| targets = [ "builder-base", "executor-base", "omnipath-debug"] | ||
| } | ||
|
|
||
| target "builder-base" { | ||
| context = "." | ||
| dockerfile = "deploy/base/Dockerfile.builder" | ||
| tags = ["unifyair/builder-base:latest"] | ||
| } | ||
|
|
||
| target "executor-base" { | ||
| context = "." | ||
| dockerfile = "deploy/base/Dockerfile.executor" | ||
| tags = ["unifyair/executor-base:latest"] | ||
| } | ||
|
|
||
| target "omnipath-debug" { | ||
| contexts = { | ||
| builder-base = "target:builder-base" | ||
| executor-base = "target:executor-base" | ||
| } | ||
| args = { | ||
| MODE = "debug" | ||
| } | ||
| dockerfile = "deploy/omnipath/Dockerfile" | ||
| tags = ["unifyair/omnipath-debug:latest"] | ||
| depends_on = ["builder-base", "executor-base"] | ||
| } | ||
|
|
||
| target "omnipath-release" { | ||
| contexts = { | ||
| builder-base = "target:builder-base" | ||
| executor-base = "target:executor-base" | ||
| } | ||
| args = { | ||
| MODE = "release" | ||
| } | ||
| dockerfile = "deploy/omnipath/Dockerfile" | ||
| tags = ["unifyair/omnipath-release:latest"] | ||
| depends_on = ["builder-base", "executor-base"] | ||
| } | ||
|
|
||
| target "gnbsim" { | ||
| dockerfile = "deploy/gnbsim/Dockerfile" | ||
| args = { | ||
| VERSION = "1.6.3" | ||
| DEBUG_TOOLS = "false" | ||
| } | ||
| tags = ["unifyair/omecproject-gnbsim:1.6.3"] | ||
| depends_on = ["builder-base", "executor-base"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Hardening & layer optimisation for builder image
apt-get installwithout--no-install-recommendspulls unnecessary packages.apt-get cleanalone leaves/var/lib/apt/listsbehind, bloating the image.cargo install cargo-chefis unpinned; builds may break on future releases.Suggested refinement:
This reduces size, improves reproducibility, and passes typical container-lint checks.
📝 Committable suggestion
🧰 Tools
🪛 RuboCop (1.76.1)
[fatal] 6-6: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using
TargetRubyVersionparameter, underAllCops)(Lint/Syntax)
[fatal] 6-6: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using
TargetRubyVersionparameter, underAllCops)(Lint/Syntax)
[fatal] 7-7: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using
TargetRubyVersionparameter, underAllCops)(Lint/Syntax)
[fatal] 8-8: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using
TargetRubyVersionparameter, underAllCops)(Lint/Syntax)
[fatal] 9-9: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using
TargetRubyVersionparameter, underAllCops)(Lint/Syntax)
[fatal] 10-10: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using
TargetRubyVersionparameter, underAllCops)(Lint/Syntax)
[fatal] 16-16: unexpected token tIDENTIFIER
(Using Ruby 2.7 parser; configure using
TargetRubyVersionparameter, underAllCops)(Lint/Syntax)
🤖 Prompt for AI Agents