Adding the parts needed to run x48 in a Docker container, for more portability.

This commit is contained in:
Dan Witt 2020-02-08 19:58:00 -07:00
parent ae74394876
commit 14f58f8675
3 changed files with 58 additions and 0 deletions

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
FROM i386/alpine:3.11 AS build
#Install the necessary things to build x48
RUN apk update && apk add bzip2 make vim gcc libx11-dev autoconf automake libc6-compat man-pages xtrans libxau-dev libxdmcp-dev libx11-dev pkgconf libxt-dev g++
#Copy over the necessary files to build x48
WORKDIR /app
COPY configure.ac version.m4 Makefile.am autogen.sh INSTALL NEWS README AUTHORS ChangeLog ./
COPY src src
COPY romdump romdump
COPY rpm rpm
COPY ROMs ROMs
COPY utils utils
RUN ./autogen.sh
RUN ./configure
RUN make
RUN cd ROMs; bunzip2 *.bz2
#Squash the layers into a smaller image with only the necessary parts.
FROM i386/alpine:3.11 as final
WORKDIR /app
COPY --from=build /app/src/x48 .
COPY --from=build /app/ROMs ./
COPY --from=build /usr/lib/libX11.so.6 /usr/lib/libxcb.so.1 /usr/lib/libXau.so.6 /usr/lib/libXdmcp.so.6 /usr/lib/libbsd.so.0 /usr/lib/
ENTRYPOINT ["./x48","-quiet"]
CMD ["-rom", "gxrom-r"]

29
runx48.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
#TODO:
# Check for the docker exec and that the user has access to start containers.
start_x48 () {
docker run --rm --network none \
--volume="/tmp/.X11-unix:/tmp/.X11-unix" \
--volume="/home/$USER:/home/$USER" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
--env="DISPLAY" \
--user $(id -u):$(id -g) \
danwitt/x48 $@
}
# IF we can't pull the image, then we need to build it
if [[ $1 == "--build" ]]; then
#Run the build process
docker build -t danwitt/x48 .
#If the build was good, start x48
if [[ $? == 0 ]]; then
start_x48 $@
fi
else
start_x48 $@
fi

View file

@ -3630,6 +3630,7 @@ int buflen;
#endif
case XK_KP_Multiply:
case XK_asterisk:
case XK_comma:
key_event(BUTTON_MUL, xev);
wake = 1;
break;