Skip to content

Instantly share code, notes, and snippets.

@mikan-megane
Created September 15, 2024 16:15
Show Gist options
  • Select an option

  • Save mikan-megane/14dc69c1cfe901f9fe0925b03aa5893d to your computer and use it in GitHub Desktop.

Select an option

Save mikan-megane/14dc69c1cfe901f9fe0925b03aa5893d to your computer and use it in GitHub Desktop.
AArch64環境でFEX-Emuを使ってSteamCMDを使えるようにするDockerfile
FROM alpine AS clone
RUN apk add --no-cache git curl jq
RUN LAST_RELEASE=$(curl https://api.github.com/repos/FEX-Emu/FEX/releases/latest -s | jq .name -r) \
&& git clone -b $LAST_RELEASE --depth=1 --recurse-submodules --shallow-submodules -j4 https://github.com/FEX-Emu/FEX.git /opt/FEX
FROM alpine AS rootfs
RUN apk add --no-cache curl squashfs-tools jq
RUN URL="$(curl https://rootfs.fex-emu.gg/RootFS_links.json | jq -r '.v1["Ubuntu 22.04 (SquashFS)"].URL')" && \
curl "$URL" > /Ubuntu_22_04.sqsh && \
unsquashfs -f -d /rootfs /Ubuntu_22_04.sqsh
FROM ubuntu:22.04 AS builder
RUN rm /var/lib/dpkg/info/libc-bin.*
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt install -y \
libc-bin cmake \
clang-13 llvm nasm ninja-build pkg-config \
libcap-dev libglfw3-dev libepoxy-dev python3-dev libsdl2-dev \
git lld
COPY --from=clone /opt/FEX /opt/FEX
WORKDIR /opt/FEX/build
RUN CC=clang-13 CXX=clang++-13 cmake -DCMAKE_BUILD_TYPE=Release -DUSE_LINKER=lld -DENABLE_LTO=True -DBUILD_TESTS=False -DENABLE_ASSERTIONS=False -G Ninja ..
RUN ninja
RUN DESTDIR=/dest ninja install
FROM ubuntu:22.04 AS runner
RUN apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt install -y \
curl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /dest/usr/. /usr/
ARG USER_ID
ARG GROUP_ID
RUN groupadd -g $GROUP_ID steam
RUN useradd -m -u $USER_ID -g $GROUP_ID -s /bin/bash steam
USER steam
WORKDIR /home/steam
COPY --from=rootfs --chown=${USER_ID}:${GROUP_ID} /rootfs /home/steam/.fex-emu/RootFS/Ubuntu_22_04
RUN echo '{"Config":{"RootFS":"Ubuntu_22_04"}}' > .fex-emu/Config.json
RUN curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
ENTRYPOINT ["FEXBash"]
# CMD [ "./steamcmd.sh", "+quit" ]
@mikan-megane
Copy link
Author

イメージが軽量になるように頑張ったけどrootfsが重いからしゃーない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment