mirror of
https://github.com/aminya/setup-cpp
synced 2024-11-30 21:22:30 +08:00
52 lines
1.5 KiB
Docker
52 lines
1.5 KiB
Docker
## 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 \
|
|
&& task build_cross_mingw'
|
|
|