Publish docker images with a woodpecker pipeline #22
3 changed files with 20 additions and 25 deletions
|
@ -17,9 +17,9 @@ steps:
|
|||
- name: build
|
||||
image: nixpkgs/nix:nixos-22.05
|
||||
commands:
|
||||
- nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.debug
|
||||
- nix build -j4 --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.debug
|
||||
|
||||
- name: test
|
||||
image: nixpkgs/nix:nixos-22.05
|
||||
commands:
|
||||
- nix build --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.test
|
||||
- nix build -j4 --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.test
|
18
.woodpecker/publish.yaml
Normal file
18
.woodpecker/publish.yaml
Normal file
|
@ -0,0 +1,18 @@
|
|||
when:
|
||||
event:
|
||||
- deployment
|
||||
- cron
|
||||
|
||||
steps:
|
||||
- name: docker build and publish
|
||||
image: nixpkgs/nix:nixos-22.05
|
||||
environment:
|
||||
DOCKER_AUTH:
|
||||
from_secret: docker_auth
|
||||
commands:
|
||||
- mkdir -p /root/.docker
|
||||
- echo $DOCKER_AUTH > /root/.docker/config.json
|
||||
- export CONTAINER_TAG=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
|
||||
- nix-build -j4 --extra-experimental-features nix-command --extra-experimental-features flakes .#packages.x86_64-linux.docker
|
||||
- nix-shell -p gzip --run "gunzip -c ./result > image.tar"
|
||||
- nix-shell -p crane --run "crane push ./image.tar dxflrs/tricot:$CONTAINER_TAG"
|
23
Dockerfile
23
Dockerfile
|
@ -1,23 +0,0 @@
|
|||
FROM rust:1.68-buster as builder
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y libssl-dev pkg-config
|
||||
|
||||
WORKDIR /srv
|
||||
|
||||
# Build dependencies and cache them
|
||||
COPY Cargo.* ./
|
||||
RUN mkdir -p src && \
|
||||
echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \
|
||||
cargo build --release && \
|
||||
rm -r src && \
|
||||
rm target/release/deps/tricot*
|
||||
|
||||
# Build final app
|
||||
COPY ./src ./src
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
RUN apt-get update && apt-get install -y libssl1.1 iptables ca-certificates
|
||||
COPY --from=builder /srv/target/release/tricot /usr/local/sbin/tricot
|
||||
CMD ["/usr/local/sbin/tricot"]
|
Loading…
Add table
Reference in a new issue