Created
June 6, 2024 16:30
-
-
Save alexlovelltroy/fa25f61ceafb44ccfe60d19795343cf1 to your computer and use it in GitHub Desktop.
Dockerfile for running OpenBMC locally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use a base image suitable for OpenBMC | |
FROM ubuntu:24.04 | |
# Install necessary dependencies for OpenBMC | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
build-essential \ | |
cmake \ | |
qemu-system \ | |
bash \ | |
locales \ | |
chrpath \ | |
cpio \ | |
diffstat \ | |
file \ | |
gawk \ | |
lz4 \ | |
wget \ | |
zstd \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN mkdir -p /opt/openbmc | |
RUN chown 65534 /opt/openbmc | |
# Set up locale | |
RUN locale-gen en_US.UTF-8 | |
ENV LANG=en_US.UTF-8 | |
ENV LANGUAGE=en_US:en | |
ENV LC_ALL=en_US.UTF-8 | |
USER 65534 | |
# Set working directory | |
WORKDIR /opt/openbmc | |
# Clone OpenBMC repository | |
RUN git clone https://github.com/openbmc/openbmc.git /opt/openbmc | |
# Set the shell to bash so we can have nice things like `source` | |
SHELL ["/bin/bash", "-c"] | |
# Copy and configure local.conf | |
RUN TEMPLATECONF=meta-phosphor/conf/templates/default source oe-init-build-env build | |
# Build OpenBMC | |
RUN TEMPLATECONF=meta-phosphor/conf/templates/default . ./openbmc-env && bitbake obmc-phosphor-image | |
# Expose necessary ports (e.g., SSH, IPMI) | |
EXPOSE 22 623 | |
# Start the OpenBMC service (example command, adjust as needed) | |
CMD ["bash", "-c", "qemu-system-arm -m 256 -M palmetto-bmc -nographic -drive file=obmc-phosphor-image-palmetto.ext4,format=raw -net nic -net user,hostfwd=tcp::2222-:22"]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment