Files

186 lines
5.0 KiB
Docker
Raw Permalink Normal View History

2025-02-10 10:01:41 +00:00
FROM --platform=linux/amd64 ubuntu:24.04 AS base
ENV DEBIAN_FRONTEND=noninteractive
2025-05-28 10:27:57 +01:00
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
python-is-python3 \
python3 \
python3-pip \
python3.12-dev \
python3.12-venv \
software-properties-common \
2025-05-28 10:27:57 +01:00
&& rm -rf /var/lib/apt/lists/*
2025-11-25 03:51:58 +00:00
COPY --from=ghcr.io/astral-sh/uv:0.9.11 /uv /bin/uv
FROM base AS nsjail
2021-08-11 13:37:24 -04:00
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
autoconf \
bison \
flex \
g++ \
gcc \
libnl-route-3-dev \
libprotobuf-dev \
libtool \
make \
pkg-config \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*
2021-08-11 13:37:24 -04:00
RUN git clone "https://github.com/google/nsjail" \
--recursive --branch 3.4 /nsjail \
2021-08-11 13:37:24 -04:00
&& cd /nsjail \
&& make
2021-08-10 22:44:39 -04:00
FROM base AS dependencies
2021-08-03 17:05:04 +01:00
2025-02-08 13:54:14 +00:00
RUN dpkg --add-architecture i386 \
&& add-apt-repository -y ppa:dosemu2/ppa \
&& add-apt-repository -y ppa:stsp-0/dj64 \
&& apt-get update \
2025-05-28 10:27:57 +01:00
&& apt-get install -y -o APT::Immediate-Configure=false --no-install-recommends \
binutils-aarch64-linux-gnu \
binutils-arm-none-eabi \
binutils-djgpp \
binutils-mingw-w64-i686 \
binutils-mips-linux-gnu \
binutils-powerpc-linux-gnu \
binutils-sh-elf \
cpp \
dj64 \
dos2unix \
dosemu2 \
gcc-mips-linux-gnu \
iptables \
libarchive-tools \
libc6-dev-i386 \
libdevmapper1.02.1 \
libgpgme11 \
libnl-route-3-200 \
libprotobuf-dev \
libtinfo6 \
netcat-traditional \
unzip \
wget \
wine \
wine32:i386 \
2021-08-10 22:44:39 -04:00
&& rm -rf /var/lib/apt/lists/*
2021-08-03 17:05:04 +01:00
2025-02-10 10:01:41 +00:00
RUN wget http://security.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb \
&& apt install ./libtinfo5_6.3-2ubuntu0.1_amd64.deb \
&& rm libtinfo5_6.3-2ubuntu0.1_amd64.deb
COPY --from=nsjail /nsjail/nsjail /bin/nsjail
2021-08-10 22:44:39 -04:00
2025-11-24 13:24:15 +00:00
COPY --from=ghcr.io/decompals/wibo:1.0.0-beta.5 /usr/local/bin/wibo /usr/bin/
2021-10-23 11:22:32 +01:00
2024-03-28 19:33:01 +01:00
# Patched mips binutils
2025-02-08 13:54:14 +00:00
RUN wget "https://github.com/decompals/binutils-mips-ps2-decompals/releases/download/v0.4/binutils-mips-ps2-decompals-linux-x86-64.tar.gz" \
&& tar xvzf binutils-mips-ps2-decompals-linux-x86-64.tar.gz -C /usr/bin mips-ps2-decompals-as mips-ps2-decompals-nm mips-ps2-decompals-objdump \
&& rm binutils-mips-ps2-decompals-linux-x86-64.tar.gz \
&& chmod +x /usr/bin/mips-ps2-decompals-*
2022-03-13 13:33:19 -04:00
# Patched PowerPC binutils
2025-02-08 13:54:14 +00:00
RUN curl -sSL "https://github.com/encounter/gc-wii-binutils/releases/download/2.42-1/linux-x86_64.zip" | \
bsdtar -xvf- -C /usr/bin \
&& chmod +x /usr/bin/powerpc-eabi-*
# MSDOS specific
RUN wget "https://github.com/OmniBlade/binutils-gdb/releases/download/omf-build/omftools.tar.gz" \
&& tar xvzf omftools.tar.gz -C /usr/bin jwasm \
&& rm omftools.tar.gz \
2025-05-28 21:38:03 +01:00
&& wget "https://github.com/decompals/binutils-omf/releases/download/v0.4/omftools-linux-x86_64.tar.gz" \
2025-02-08 13:54:14 +00:00
&& tar xvzf omftools-linux-x86_64.tar.gz -C /usr/bin omf-nm omf-objdump \
&& rm omftools-linux-x86_64.tar.gz
RUN mkdir -p /etc/fonts
2022-07-29 11:41:20 -04:00
ENV WINEPREFIX=/tmp/wine
2025-02-10 10:01:41 +00:00
# Ensure /sandbox and wine dirs have correct ownership
RUN mkdir -p /sandbox \
&& chown -R ubuntu:ubuntu /sandbox \
2022-07-29 11:41:20 -04:00
&& mkdir -p "${WINEPREFIX}" \
2025-02-10 10:01:41 +00:00
&& chown ubuntu:ubuntu "${WINEPREFIX}"
2025-02-08 13:54:14 +00:00
# Switch to non-root user
2025-02-10 10:01:41 +00:00
USER ubuntu
2025-02-10 10:01:41 +00:00
# Initialize wine files to /home/ubuntu/.wine
2025-02-08 13:54:14 +00:00
RUN wineboot --init
2022-07-29 11:41:20 -04:00
2025-05-28 10:27:57 +01:00
WORKDIR /backend
2022-02-20 08:46:00 -05:00
FROM dependencies AS dev
2025-02-08 13:54:14 +00:00
ARG ENABLE_DREAMCAST_SUPPORT
ARG ENABLE_GBA_SUPPORT
2025-02-08 13:54:14 +00:00
ARG ENABLE_GC_WII_SUPPORT
ARG ENABLE_MACOSX_SUPPORT
2025-02-08 13:54:14 +00:00
ARG ENABLE_MSDOS_SUPPORT
2023-10-23 21:54:35 +01:00
ARG ENABLE_N3DS_SUPPORT
ARG ENABLE_N64_SUPPORT
2023-10-26 15:27:25 +01:00
ARG ENABLE_NDS_ARM9_SUPPORT
2023-10-09 16:37:14 +01:00
ARG ENABLE_PS1_SUPPORT
2025-02-08 13:54:14 +00:00
ARG ENABLE_PS2_SUPPORT
ARG ENABLE_PSP_SUPPORT
2023-11-15 15:18:38 +00:00
ARG ENABLE_SATURN_SUPPORT
ARG ENABLE_SWITCH_SUPPORT
2025-02-08 13:54:14 +00:00
ARG ENABLE_WIN32_SUPPORT
ENV ENABLE_DREAMCAST_SUPPORT=${ENABLE_DREAMCAST_SUPPORT} \
ENABLE_GBA_SUPPORT=${ENABLE_GBA_SUPPORT} \
ENABLE_GC_WII_SUPPORT=${ENABLE_GC_WII_SUPPORT} \
ENABLE_MACOSX_SUPPORT=${ENABLE_MACOSX_SUPPORT} \
ENABLE_MSDOS_SUPPORT=${ENABLE_MSDOS_SUPPORT} \
ENABLE_N3DS_SUPPORT=${ENABLE_N3DS_SUPPORT} \
ENABLE_N64_SUPPORT=${ENABLE_N64_SUPPORT} \
ENABLE_NDS_ARM9_SUPPORT=${ENABLE_NDS_ARM9_SUPPORT} \
ENABLE_PS1_SUPPORT=${ENABLE_PS1_SUPPORT} \
ENABLE_PS2_SUPPORT=${ENABLE_PS2_SUPPORT} \
ENABLE_PSP_SUPPORT=${ENABLE_PSP_SUPPORT} \
ENABLE_SATURN_SUPPORT=${ENABLE_SATURN_SUPPORT} \
ENABLE_SWITCH_SUPPORT=${ENABLE_SWITCH_SUPPORT} \
ENABLE_WIN32_SUPPORT=${ENABLE_WIN32_SUPPORT}
2021-08-03 17:05:04 +01:00
ENTRYPOINT ["/backend/docker_entrypoint.sh"]
FROM base AS uv-install
USER ubuntu
WORKDIR /backend
COPY pyproject.toml uv.lock /backend/
RUN uv sync --locked
FROM dependencies AS prod
COPY --from=uv-install /backend/.venv /backend/.venv
COPY manage.py /backend
COPY housekeeping.py /backend
COPY wine /backend/wine
COPY decompme /backend/decompme
COPY libraries /backend/libraries
COPY compilers /backend/compilers
COPY coreapp /backend/coreapp
COPY docker_prod_entrypoint.sh /backend/docker_prod_entrypoint.sh
ENTRYPOINT ["/backend/docker_prod_entrypoint.sh"]