Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: slim down the matchmaker docker image. #119

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,23 @@
# Bones Matchmaker Docker image
#

FROM rust:1.64-slim as builder

RUN apt-get update && \
apt-get install -y \
curl \
pkg-config \
libudev-dev \
libasound2-dev && \
rm -rf /var/lib/apt/lists/*
FROM rust:1.69.0-slim as builder

WORKDIR /usr/src/bones
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry/cache \
--mount=type=cache,target=/usr/local/cargo/registry/index \
--mount=type=cache,target=/usr/local/cargo/git/db \
--mount=type=cache,target=/usr/src/bones/target \
cargo build -p bones_matchmaker
# Uncomment if building with behind custom CA cert
--mount=type=bind,src=./cacert.gitignore.crt,target=/etc/ssl/certs/ca-certificates.crt \
cargo build --release -p bones_matchmaker

RUN --mount=type=cache,target=/usr/src/bones/target \
cp target/debug/bones_matchmaker /usr/local/bin/bones_matchmaker
cp target/release/bones_matchmaker /usr/local/bin/bones_matchmaker

# TODO: Slim down this container. We need to try and strip all unneeded deps from Bevy for the
# matchmaker.
FROM debian:bullseye
RUN apt-get update && apt-get install -y libasound2 && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/bin/bones_matchmaker /usr/local/bin/bones_matchmaker
FROM ubuntu:23.04
USER 1001
COPY --from=builder /usr/local/bin/bones_matchmaker /bones_matchmaker
EXPOSE 8943/udp
ENTRYPOINT /usr/local/bin/bones_matchmaker
CMD /bones_matchmaker
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.67
1.69.0