Skip to content

Commit 295f636

Browse files
just docker again
1 parent 3372484 commit 295f636

7 files changed

Lines changed: 18 additions & 174 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -108,77 +108,4 @@ jobs:
108108
- 8080:8080
109109
needs: [merge-docker]
110110
steps:
111-
- run: curl --fail http://localhost:8080/
112-
113-
build-debs:
114-
needs: [check]
115-
runs-on: ${{ matrix.platform.gha-image }}
116-
strategy:
117-
fail-fast: false
118-
matrix:
119-
platform:
120-
- slug: amd64
121-
gha-image: ubuntu-24.04
122-
- slug: arm64
123-
gha-image: ubuntu-24.04-arm
124-
steps:
125-
- name: Check out code
126-
uses: actions/checkout@v4
127-
128-
- name: Install cargo
129-
uses: dtolnay/rust-toolchain@stable
130-
131-
- name: Install apt dependencies
132-
run: sudo apt-get install jq dpkg-dev
133-
134-
- name: Prepare cache
135-
uses: Swatinem/rust-cache@v2
136-
with:
137-
key: ${{ matrix.platform.slug }}
138-
139-
- name: Build binary
140-
run: cargo b --release
141-
142-
- name: Generate deb templates
143-
run: ci/debpkg.sh ${{ matrix.platform.slug }}
144-
145-
- name: Package debfiles
146-
run: dpkg --build target/deb/*
147-
148-
- name: Upload debfile
149-
uses: actions/upload-artifact@v4
150-
with:
151-
name: deb-${{ matrix.platform.slug }}
152-
path: target/deb/*.deb
153-
154-
publish-debs:
155-
needs: [build-debs]
156-
runs-on: ubuntu-latest
157-
steps:
158-
- name: Check out code
159-
uses: actions/checkout@v4
160-
161-
- name: Install apt dependencies
162-
run: sudo apt-get install dpkg-dev gpg
163-
164-
- name: Install s3 CLI
165-
run: sudo snap install aws-cli --classic
166-
167-
- name: Download debfiles
168-
uses: actions/download-artifact@v4
169-
with:
170-
pattern: deb-*
171-
merge-multiple: true
172-
173-
- name: Import private keys
174-
run: echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --import
175-
176-
- name: Sign and prepare apt repo
177-
run: ./ci/signify.sh *.deb
178-
179-
- name: Publish
180-
run: aws s3 sync apt-repo/mcping/ s3://apt-repos/mcping/
181-
env:
182-
AWS_ENDPOINT_URL: https://${{ secrets.S3_ACCOUNT_ID }}.r2.cloudflarestorage.com/
183-
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
184-
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
111+
- run: curl --fail http://localhost:8080/

Dockerfile

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
FROM rust:alpine AS server-builder
2-
3-
RUN apk add musl-dev
4-
5-
WORKDIR /build
6-
7-
COPY . .
8-
9-
RUN cargo build --release
10-
111
FROM ghcr.io/randomairborne/asset-squisher:latest AS client-builder
122

133
COPY /assets/ /uncompressed-assets/
144

155
RUN asset-squisher /uncompressed-assets/ /assets/
166

17-
FROM scratch
7+
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
8+
WORKDIR /app
189

19-
WORKDIR /
10+
FROM chef AS planner
11+
COPY . .
12+
RUN cargo chef prepare --recipe-path recipe.json
13+
14+
FROM chef AS builder
15+
COPY --from=planner /app/recipe.json recipe.json
16+
RUN cargo chef cook --release --recipe-path recipe.json
17+
COPY . .
18+
RUN cargo build --release
19+
20+
FROM debian:bookworm-slim AS runtime
21+
WORKDIR /app
2022

21-
COPY --from=server-builder /build/target/release/mcping /usr/bin/mcping
22-
COPY --from=server-builder /build/target/release/mcping-healthcheck /usr/bin/mcping-healthcheck
23+
COPY --from=builder /app/target/release/mcping /usr/local/bin
24+
COPY --from=server-builder /app/target/release/mcping-healthcheck /usr/local/bin/mcping-healthcheck
2325
COPY --from=client-builder /assets/ /var/www/mcping/
2426

2527
ENV ASSET_DIR="/var/www/mcping/"
26-
2728
HEALTHCHECK --interval=5s --timeout=5s --retries=5 CMD ["/usr/bin/mcping-healthcheck", "http://127.0.0.1:8080"]
28-
ENTRYPOINT ["/usr/bin/mcping"]
29+
ENTRYPOINT ["/usr/local/bin/mcping"]

ci/debpkg.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

ci/gencontrol.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

ci/generate-release.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

ci/get-version.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

ci/signify.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)