add .gitlab-ci.yml

add Dockerfile
This commit is contained in:
lychang
2024-01-12 04:21:33 +08:00
parent 86e60f1e5c
commit a4be88e901
3 changed files with 1606 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
stages:
- generate_image
- deploy
- notify
variables:
BUILD_NAME: "rust/tuiimg"
SERVICE_NAME: "spyder"
IMAGE_TAG: "dev"
generate_image_dev:
variables:
IMAGE_TAG: dev
stage: generate_image
image: docker:20.10.2
script:
- docker build -t $BUILD_NAME:$IMAGE_TAG .
tags:
- '001'
only:
- dev
except:
- triggers

1563
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,20 @@
FROM ubuntu:latest
LABEL authors="123ee"
FROM rust:1.50 as builder
ENTRYPOINT ["top", "-b"]
WORKDIR /app
ARG APP=imspyder
RUN USER=root cargo new $APP
WORKDIR /app/$APP
RUN mkdir -p .cargo
COPY config.toml .cargo/
COPY Cargo.toml Cargo.lock ./
COPY ./src src
RUN cargo install --path . --color always
# Copy the app to an base Docker image, here we use distroless
FROM alpine:latest
RUN mkdir -p /cache
COPY --from=builder /usr/local/cargo/bin/$APP /$APP
USER 1000
ENTRYPOINT ["/$APP"]