Update docker image, add drone pipeline
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Emelie Graven 2021-11-16 16:03:41 +01:00
parent 3dcc080f9d
commit 5a95ec4586
Signed by: emelie
GPG key ID: C11123726DBB55A1
2 changed files with 34 additions and 14 deletions

13
.drone.yml Normal file
View file

@ -0,0 +1,13 @@
kind: pipeline
name: default
steps:
- name: docker
image: plugins/docker
settings:
repo: egraven/zola
auto_tag: true
username: egraven
password:
from_secret: DOCKER_TOKEN

View file

@ -1,21 +1,28 @@
FROM rust:slim AS builder
FROM lukemathwalker/cargo-chef:latest-rust-slim AS chef
WORKDIR zola
RUN apt-get update -y && \
apt-get install -y python-pip make g++ python-setuptools libssl-dev pkg-config rsync && \
pip install dockerize && \
rustup target add x86_64-unknown-linux-gnu
FROM chef AS deps
#RUN rustup target add x86_64-unknown-linux-musl
RUN apt-get update && apt-get install -y make g++ pkg-config libssl-dev # musl-tools
WORKDIR /app
FROM deps AS recipe
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
RUN cargo build --release --target x86_64-unknown-linux-gnu
FROM deps AS build
COPY --from=recipe /zola/recipe.json recipe.json
#RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
RUN mv target/x86_64-unknown-linux-gnu/release/zola /usr/bin
RUN mkdir -p /workdir
WORKDIR /workdir
RUN dockerize -n -o /workdir /usr/bin/zola
COPY . .
#RUN cargo build --release --target x86_64-unknown-linux-musl --bin zola
RUN cargo build --release --bin zola
FROM debian:bullseye-slim AS runtime
WORKDIR zola
#COPY --from=build zola/target/x86_64-unknown-linux-musl/release/zola /usr/local/bin/
COPY --from=build zola/target/release/zola /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/zola"]
LABEL org.opencontainers.image.authors="Emelie Graven <emelie@graven.dev>"
FROM scratch
COPY --from=builder /workdir .
ENTRYPOINT [ "/usr/bin/zola" ]