Merge branch 'feat/ci' into 'main'

Introduce CI

See merge request perditum/rnex-splatoon!11
This commit is contained in:
andrea 2025-03-06 10:56:36 +00:00
commit cf17cc88d3
2 changed files with 43 additions and 0 deletions

19
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,19 @@
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"

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
FROM rust:1.85 AS builder
WORKDIR /app
COPY . .
RUN apt-get update && apt-get install protobuf-compiler -y
RUN git submodule update --init --recursive
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"]