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

Improve dockerfile #15

Open
wants to merge 6 commits into
base: trunk
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
56 changes: 46 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@
# V0 - Use this comment to force a re-build without changing the contents

# Stage 1 - Build the toolchain
FROM ubuntu:18.04
FROM debian:stable-slim AS toolchain-builder
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Install required dependencies
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils \
&& apt-get install -y \
curl \
bzip2 \
make \
file \
libmpfr-dev \
libmpc-dev \
zlib1g-dev \
texinfo \
git \
gcc \
g++

ARG N64_INST=/n64_toolchain
ENV N64_INST=${N64_INST}

# install dependencies
RUN apt-get update
RUN apt-get install -yq wget bzip2 gcc g++ make file libmpfr-dev libmpc-dev zlib1g-dev texinfo git gcc-multilib

# Build
COPY ./tools/build-toolchain.sh /tmp/tools/build-toolchain.sh
WORKDIR /tmp/tools
Expand All @@ -19,13 +34,34 @@ RUN ./build-toolchain.sh
RUN rm -rf ${N64_INST}/share/locale/*

# Stage 2 - Prepare minimal image
FROM ubuntu:18.04
FROM debian:stable-slim
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# Setup paths for the libgragon toolchain
ARG N64_INST=/n64_toolchain
ENV N64_INST=${N64_INST}
ENV PATH="${N64_INST}/bin:$PATH"

COPY --from=0 ${N64_INST} ${N64_INST}
# Install dependencies for building libdragon tools and ROMS (using makefiles and CMake)
# and (commented out) ability to use it as a vs-code devcontainer.
RUN apt-get update && \
apt-get install -yq gcc g++ make libpng-dev git && \
apt-get clean && \
apt autoremove -yq
apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 &&\
apt-get install -yq \
gcc \
g++ \
make \
libpng-dev \
git \
curl \
cmake \
ninja-build

COPY --from=toolchain-builder ${N64_INST} ${N64_INST}

# Clean up downloaded files
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog