From 235f1dfd6b65c9bf4f4031a2d09634fce2ac5c1d Mon Sep 17 00:00:00 2001 From: Andrea Toska Date: Thu, 6 Mar 2025 09:50:48 +0100 Subject: [PATCH 1/7] feat(ci): introduce ci --- .gitlab-ci.yml | 21 +++++++++++++++++++++ Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..d1908a2 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,21 @@ +image: docker:latest + +variables: + IMAGE_NAME: "ci.perditum.com/perditum/rnex-splatoon" + IMAGE_TAG: "${CI_COMMIT_REF_SLUG}" + +before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" ci.perditum.com + +stages: + - build-and-push + +build-and-push: + stage: build-and-push + script: + - docker build -t "$IMAGE_NAME:$IMAGE_TAG" . + - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$IMAGE_NAME:latest" + - docker push "$IMAGE_NAME:$IMAGE_TAG" + - docker push "$IMAGE_NAME:latest" + only: + - main diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..55951b3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM rust:1.85 AS builder + +WORKDIR /app + +COPY . . + +RUN cargo build --release + +FROM rust:1.85 AS final + +WORKDIR /app + +# Copy the compiled binary from the builder stage +COPY --from=builder /app/target/release/splatoon-server-rust /app/splatoon-server-rust + +# Set executable permissions +RUN chmod +x /app/splatoon-server-rust + +# Command to run the application +CMD ["/app/splatoon-server-rust"] From b2abacbdba37888b05b7dadc9e5b6d625c62e987 Mon Sep 17 00:00:00 2001 From: andrea <1-ssdrive@users.noreply.git.perditum.com> Date: Thu, 6 Mar 2025 08:53:02 +0000 Subject: [PATCH 2/7] fix(ci): remove branch specification --- .gitlab-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d1908a2..56c6940 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,5 +17,3 @@ build-and-push: - docker tag "$IMAGE_NAME:$IMAGE_TAG" "$IMAGE_NAME:latest" - docker push "$IMAGE_NAME:$IMAGE_TAG" - docker push "$IMAGE_NAME:latest" - only: - - main From fb3ecd2ec0bf6d6b8bb9d7a4e43c05f24155aefa Mon Sep 17 00:00:00 2001 From: Andrea Toska Date: Thu, 6 Mar 2025 09:58:22 +0100 Subject: [PATCH 3/7] fix(ci): add protoc --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 55951b3..a02795d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,8 @@ WORKDIR /app COPY . . +RUN apt install protobuf-compiler + RUN cargo build --release FROM rust:1.85 AS final From f2d0b207d475338cdc4e4b3d4d80a3a8fdf07a80 Mon Sep 17 00:00:00 2001 From: Andrea Toska Date: Thu, 6 Mar 2025 10:01:28 +0100 Subject: [PATCH 4/7] fix(ci): run an apt update --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a02795d..95fb9a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app COPY . . -RUN apt install protobuf-compiler +RUN apt-get update && apt-get install protobuf-compiler RUN cargo build --release From 9e1c51a0993f3153468153f7fd97a61198cc767b Mon Sep 17 00:00:00 2001 From: Andrea Toska Date: Thu, 6 Mar 2025 10:04:33 +0100 Subject: [PATCH 5/7] fix(docker): whoops, missed the -y argument --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 95fb9a1..2d024cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ WORKDIR /app COPY . . -RUN apt-get update && apt-get install protobuf-compiler +RUN apt-get update && apt-get install protobuf-compiler -y RUN cargo build --release From 1bfa8edd1fdc16720ce71f946860a7f73961aae2 Mon Sep 17 00:00:00 2001 From: Andrea Toska Date: Thu, 6 Mar 2025 10:12:55 +0100 Subject: [PATCH 6/7] fix(ci): debug protoc --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2d024cc..3f14281 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ COPY . . RUN apt-get update && apt-get install protobuf-compiler -y +RUN which protoc + RUN cargo build --release FROM rust:1.85 AS final From d3b752f5a79a4bae23d90cd7d8f97cb65e87c14d Mon Sep 17 00:00:00 2001 From: Andrea Toska Date: Thu, 6 Mar 2025 10:20:19 +0100 Subject: [PATCH 7/7] fix(ci): submodules --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3f14281..5c73325 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ COPY . . RUN apt-get update && apt-get install protobuf-compiler -y -RUN which protoc +RUN git submodule update --init --recursive RUN cargo build --release