summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore2
-rw-r--r--.gitlab-ci.yml10
-rw-r--r--Dockerfile12
3 files changed, 24 insertions, 0 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..39b0595
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+.git
+target \ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 75e13b5..922bd2b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,5 +1,6 @@
stages:
- build
+ - container
build_and_test:
image: rust:alpine3.16
@@ -19,3 +20,12 @@ build_and_test:
script:
- cargo build
- cargo test
+container:
+ image: docker:stable
+ stage: container
+ script:
+ - docker build . -t $CI_REGISTRY_IMAGE
+ - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
+ - docker push $CI_REGISTRY_IMAGE
+
+
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..a545eb1
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,12 @@
+FROM docker.io/rust:slim-bullseye as builder
+WORKDIR /app
+RUN apt update && apt install libssl-dev pkg-config -y
+RUN cargo install cargo-prefetch
+RUN cargo prefetch
+COPY Cargo* /app/
+COPY src /app/src
+RUN cargo build --release
+FROM docker.io/debian:bullseye-slim
+COPY --from=builder /app/target/release/vavbot /vavbot
+RUN apt update && apt install openssl ca-certificates -y
+CMD [ "/vavbot" ] \ No newline at end of file