2022-12-30 05:00:49 +08:00
|
|
|
## base image
|
|
|
|
FROM archlinux as base
|
|
|
|
|
|
|
|
RUN pacman -Syuu --noconfirm
|
|
|
|
RUN pacman-db-upgrade
|
|
|
|
|
|
|
|
# yay for AUR installs
|
|
|
|
RUN pacman -S --noconfirm --needed git base-devel
|
|
|
|
## can't run makepkg as root, "ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system."
|
|
|
|
## add new user
|
|
|
|
RUN useradd -m -G nobody -s /bin/bash yay && passwd -d yay && echo "yay ALL=(ALL) ALL" >> /etc/sudoers
|
|
|
|
RUN git clone --depth 1 https://aur.archlinux.org/yay.git /opt/yay && \
|
|
|
|
chown -R yay:root /opt/yay && chmod -R 775 /opt/yay
|
|
|
|
USER yay
|
|
|
|
RUN cd /opt/yay && makepkg -si --noprogressbar --noconfirm
|
|
|
|
USER root
|
|
|
|
RUN rm -rf /tmp/yay
|
|
|
|
|
|
|
|
# nodejs
|
|
|
|
RUN pacman -S --noconfirm --needed nodejs
|
|
|
|
|
|
|
|
# curl for downloading setup-cpp
|
|
|
|
RUN pacman -S --noconfirm --needed curl
|
|
|
|
|
|
|
|
# add setup_cpp.js
|
|
|
|
COPY "./dist/node12" "/"
|
|
|
|
WORKDIR "/"
|
|
|
|
|
|
|
|
# run installation
|
|
|
|
RUN node ./setup_cpp.js --cmake true --ninja true --ccache true --vcpkg true --doxygen true --gcovr true --task true
|
|
|
|
## ERROR: Running makepkg as root is not allowed as it can cause permanent,
|
|
|
|
## Error: Command failed with exit code 1: sudo 'yay' '-S' '--noconfirm' 'powershell-bin'
|
|
|
|
## need to run this as yay-user so I can install powershell and mingw
|
|
|
|
USER yay
|
|
|
|
RUN node ./setup_cpp.js --compiler mingw --powershell true
|
|
|
|
USER root
|
|
|
|
|
|
|
|
# clean up
|
|
|
|
RUN pacman -Scc --noconfirm
|
|
|
|
RUN rm -rf /tmp/*
|
|
|
|
|
|
|
|
CMD source ~/.cpprc
|
|
|
|
ENTRYPOINT [ "/bin/bash" ]
|
|
|
|
|
|
|
|
#### Building
|
|
|
|
FROM base AS builder
|
|
|
|
COPY ./dev/cpp_vcpkg_project /home/app
|
|
|
|
WORKDIR /home/app
|
|
|
|
RUN bash -c 'source ~/.cpprc \
|
2022-12-30 07:12:00 +08:00
|
|
|
&& task build_cross_mingw'
|
2022-12-30 05:00:49 +08:00
|
|
|
|