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

ch6: particles: working Dockerfile to see graphical output #96

Open
wants to merge 1 commit into
base: 1st-edition
Choose a base branch
from
Open
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
21 changes: 18 additions & 3 deletions ch6/ch6-particles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
FROM rust:1.30
# Build container with:
#
# docker build . --tag particles
#
# Run container with something like:
#
# XSOCK=/tmp/.X11-unix
# XAUTH=/tmp/.docker.xauth
# touch "${XAUTH}"
# xauth nlist :0 | sed -e 's/^..../ffff/' | xauth -f "${XAUTH}" nmerge -
# docker run -ti -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v "${XSOCK}:${XSOCK}" -v "${XAUTH}:${XAUTH}" -v /dev/dri/card0:/dev/dri/card0 -e "XAUTHORITY=${XAUTH}" -e DISPLAY -e HOME -e USER --user "$(id -u):$(id -g)" --rm particles
#
FROM rust:1.66

RUN apt-get update
RUN apt-get -y install libxcursor-dev libxrandr2 libxi6 libx11-xcb1 libgl1

WORKDIR /opt/particles
COPY . .
RUN [[ -f Cargo.lock ]] && rm Cargo.lock || true
RUN test -f Cargo.lock && rm Cargo.lock || true
RUN cargo build
CMD ["particles"]
CMD ["/opt/particles/target/debug/ch6-particles"]