mirror of
https://codeberg.org/icewind/prometheus-mdns-rs.git
synced 2026-06-03 09:54:21 +02:00
nix docker image
This commit is contained in:
parent
c0e8c2bc19
commit
f5630c7960
5 changed files with 37 additions and 27 deletions
|
|
@ -1,4 +0,0 @@
|
|||
/target
|
||||
**/*.rs.bk
|
||||
result
|
||||
.direnv
|
||||
22
.github/workflows/ci.yaml
vendored
22
.github/workflows/ci.yaml
vendored
|
|
@ -7,10 +7,28 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v20
|
||||
- uses: cachix/install-nix-action@v25
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build
|
||||
- run: nix build
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v25
|
||||
- uses: icewind1991/attic-action@v1
|
||||
with:
|
||||
name: ci
|
||||
instance: https://cache.icewind.me
|
||||
authToken: '${{ secrets.ATTIC_TOKEN }}'
|
||||
- run: nix build .#docker
|
||||
- name: Push image
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
skopeo copy --dest-creds="${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_TOKEN }}" "docker-archive:$(nix build .#docker --print-out-paths)" "docker://icewind1991/prometheus-mdns-sd"
|
||||
21
Dockerfile
21
Dockerfile
|
|
@ -1,21 +0,0 @@
|
|||
FROM ekidd/rust-musl-builder AS build
|
||||
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
|
||||
# Build with a dummy main to pre-build dependencies
|
||||
RUN mkdir src && \
|
||||
sudo chown -R rust:rust . && \
|
||||
echo "fn main(){}" > src/main.rs && \
|
||||
cargo build --release && \
|
||||
rm -r src
|
||||
|
||||
COPY src/ ./src/
|
||||
RUN sudo chown -R rust:rust . && touch src/main.rs
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=build /home/rust/src/target/x86_64-unknown-linux-musl/release/prometheus-mdns-sd-rs /
|
||||
|
||||
CMD ["/prometheus-mdns-sd-rs"]
|
||||
16
docker.nix
Normal file
16
docker.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
dockerTools,
|
||||
prometheus-mdns-sd,
|
||||
}:
|
||||
dockerTools.buildLayeredImage {
|
||||
name = "icewind1991/prometheus-mdns-sd";
|
||||
tag = "latest";
|
||||
maxLayers = 5;
|
||||
contents = [
|
||||
prometheus-mdns-sd
|
||||
dockerTools.caCertificates
|
||||
];
|
||||
config = {
|
||||
Cmd = ["prometheus-mdns-sd-rs"];
|
||||
};
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
in rec {
|
||||
packages = rec {
|
||||
prometheus-mdns-sd = pkgs.prometheus-mdns-sd;
|
||||
docker = pkgs.callPackage ./docker.nix {};
|
||||
default = prometheus-mdns-sd;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue