~nickbp/iplookup

c44137e94f1d3500b9bc3d4654e66ea904531404 — Nick Parker 4 months ago 89d9e6e main
Disable failing arm64 CI, simplify image build
2 files changed, 12 insertions(+), 11 deletions(-)

M .build.yml
M Dockerfile
M .build.yml => .build.yml +3 -1
@@ 12,7 12,9 @@ secrets:
environment:
  REPO_NAME: iplookup
  IMAGE_NAME: ghcr.io/nickbp/iplookup
  IMAGE_PLATFORMS: linux/amd64,linux/arm64
  # Disable arm64 for now: Seeing 'Killed' in sourcehut build
  #IMAGE_PLATFORMS: linux/amd64,linux/arm64
  IMAGE_PLATFORMS: linux/amd64
  BUILDAH_FORMAT: docker # 'oci' default doesn't list architectures on hub.docker.com
tasks:
# build amd64+arm64 images

M Dockerfile => Dockerfile +9 -10
@@ 3,21 3,20 @@
# Builder image, with initial project for Cargo.* deps to build in

FROM docker.io/library/rust:slim
RUN cargo install cargo-build-deps \
  && cd / \
  && cargo new --bin iplookup

# Build dependencies on their own as separate step to improve cached builds
# (only copy Cargo.* to avoid source changes breaking this cache)
COPY Cargo.toml Cargo.lock /iplookup
RUN cd /iplookup && cargo build-deps --release
RUN apt-get update \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists /var/cache/apt/archives \
  && cargo --version

COPY . /iplookup
RUN cd /iplookup && cargo build --all-targets --release
RUN cd /iplookup && cargo build --release

# Release image: copy executable from builder
# Debian version needs to match builder image to avoid linker issues.

FROM debian:bullseye-slim
FROM docker.io/library/debian:bullseye-slim
RUN apt-get update \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists /var/cache/apt/archives
COPY --from=0 /iplookup/target/release/iplookup /iplookup
RUN chmod +x /iplookup