aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 1a054002bd1ffa40f22cf4ae101f9a71b26b5130 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/docker
#     ____             __             ____  ______  __
#    / __ \____  _____/ /_____  _____/ __ \/ ___/ |/ /
#   / / / / __ \/ ___/ //_/ _ \/ ___/ / / /\__ \|   / 
#  / /_/ / /_/ / /__/ ,< /  __/ /  / /_/ /___/ /   |  
# /_____/\____/\___/_/|_|\___/_/   \____//____/_/|_|  
# 
# Title:            Mac on Docker (Docker-OSX)
# Author:           Sick.Codes https://sick.codes/        
# Version:          1.0
# License:          GPLv3
# 
# All credits for OSX-KVM and the rest at Kholia's repo: https://github.com/kholia/osx-kvm
# OpenCore support go to https://github.com/Leoyzen/KVM-Opencore 
# and https://github.com/thenickdude/KVM-Opencore/
# 
# This Dockerfile automates the installation of Docker-OSX
# It will build a 32GB Mojave Disk, you can change the size using build arguments.
# This file builds on top of the work done by Dhiru Kholia and many others.
#       
# Build:
#
#       docker build -t docker-osx .
# 
#       docker build -t docker-osx --build-arg VERSION=10.14.6 --build-arg SIZE=200G
#       
# Run:
#       
#       docker run --privileged -v /tmp/.X11-unix:/tmp/.X11-unix docker-osx
#      

FROM archlinux:latest

MAINTAINER 'https://sick.codes' <https://sick.codes>

# change disk size here or add during build, e.g. --build-arg VERSION=10.14.6 --build-arg SIZE=50G
ARG SIZE=32G
ARG VERSION=10.14.6

# This fails on hub.docker.com
# RUN [[ $(egrep -c '(svm|vmx)' /proc/cpuinfo) -gt 0 ]] || { echo KVM not possible on this host && exit 1; }

WORKDIR /root
RUN tee -a /etc/pacman.conf <<< '[community-testing]'
RUN tee -a /etc/pacman.conf <<< 'Include = /etc/pacman.d/mirrorlist'

RUN pacman -Syu --noconfirm
RUN pacman -S sudo git make automake gcc python go autoconf cmake pkgconf alsa-utils fakeroot --noconfirm
RUN useradd arch
RUN echo 'arch ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
RUN mkdir /home/arch
RUN chown arch:arch /home/arch

USER arch
WORKDIR /home/arch
RUN git clone https://github.com/corpnewt/gibMacOS.git
WORKDIR /home/arch/gibMacOS
RUN perl -p -i -e 's/print("Succeeded:")/exit()/' ./gibMacOS.command

# this command takes a while!
RUN python gibMacOS.command -v "${VERSION}" -d || echo Done

RUN sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison ebtables edk2-ovmf --noconfirm
# RUN sudo systemctl enable libvirtd.service
# RUN sudo systemctl enable virtlogd.service

WORKDIR /home/arch
RUN git clone https://github.com/kholia/OSX-KVM.git

RUN sudo pacman -Syu netctl libvirt-dbus libguestfs --noconfirm

WORKDIR /home/arch/OSX-KVM
RUN sed -i -e 's/usb-mouse/usb-tablet/g' OpenCore-Boot.sh
RUN chmod +x OpenCore-Boot.sh

WORKDIR /home/arch/OSX-KVM
RUN qemu-img convert ${HOME}/gibMacOS/macOS\ Downloads/publicrelease/*/BaseSystem.dmg -O raw ${HOME}/OSX-KVM/BaseSystem.img
RUN qemu-img create -f qcow2 mac_hdd_ng.img "${SIZE}"

RUN perl -p -i -e \
's/-netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27/-netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:09:49:17/' \
./OpenCore-Boot.sh

ENV DISPLAY :0.0
ENV USER arch
USER arch
VOLUME ["/tmp/.X11-unix"]

CMD ./OpenCore-Boot.sh