rewrite dockerfile / deployment
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -1,10 +1,21 @@
|
|||||||
FROM rust:1.43 as builder
|
FROM rust:1.47 as builder
|
||||||
|
|
||||||
WORKDIR /usr/src/sarcastifybot
|
WORKDIR /usr/src/sarcastifybot
|
||||||
|
|
||||||
|
# Avoid having to install/build all dependencies by copying
|
||||||
|
# the Cargo files and making a dummy src/main.rs
|
||||||
|
COPY Cargo.toml .
|
||||||
|
COPY Cargo.lock .
|
||||||
|
RUN mkdir -p src && echo "fn main() {}" > src/main.rs
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# We need to touch our real main.rs file or else docker will use
|
||||||
|
# the cached one.
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo install --path .
|
RUN touch src/main.rs
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
FROM debian:buster
|
FROM debian:buster
|
||||||
RUN apt-get update && apt-get install -y openssl ca-certificates
|
RUN apt-get update && apt-get install -y openssl ca-certificates
|
||||||
COPY --from=builder /usr/local/cargo/bin/sarcastifybot /usr/local/bin/sarcastifybot
|
COPY --from=builder /usr/src/sarcastifybot/target/release/sarcastifybot /usr/local/bin/sarcastifybot
|
||||||
CMD ["sarcastifybot"]
|
CMD ["sarcastifybot"]
|
||||||
|
|||||||
23
deployment.yml
Normal file
23
deployment.yml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: sarcastifybot
|
||||||
|
labels:
|
||||||
|
app: sarcastifybot
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: sarcastifybot
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: sarcastifybot
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: main
|
||||||
|
image: harbor.blacknova.io/nvls/sarcastifybot:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
env:
|
||||||
|
- name: TELEGRAM_BOT_TOKEN
|
||||||
|
value: "924754197:AAGvpdqUY-2pOy1wnQIW2zeS-oA7-lxwfqU"
|
||||||
Reference in New Issue
Block a user