fix: clean up docker files

This commit is contained in:
abeimler 2023-05-01 11:24:36 +02:00
parent c4c3576054
commit 72b58a4d1b
9 changed files with 13 additions and 193 deletions

View File

@ -135,9 +135,6 @@ jobs:
container:
- "arch_node.dockerfile"
- "fedora_node.dockerfile"
- "ubuntu_20.04_node_legacy.dockerfile"
- "ubuntu_20.04_node.dockerfile"
- "ubuntu_node_legacy.dockerfile"
- "ubuntu_node.dockerfile"
steps:
- uses: actions/checkout@v3

@ -1 +1 @@
Subproject commit c30589196b2c59a3055dfc7c24244b4a1f48b081
Subproject commit b10f2e841835b93cee67dff1eb70d6fa5c0ac0cd

View File

@ -1,15 +1,9 @@
## base image
FROM archlinux as base
RUN pacman -Syuu --noconfirm
RUN pacman-db-upgrade
# install nodejs
RUN pacman -S --noconfirm --needed nodejs npm git
# install pnpm
#RUN pacman -S --noconfirm --needed pnpm
RUN npm install -g pnpm
# install nodejs and pnpm
RUN pacman -Syuu --noconfirm && pacman-db-upgrade && pacman -S --noconfirm --needed nodejs npm git \
&& npm install -g pnpm
#### Building

View File

@ -2,10 +2,8 @@
FROM fedora as base
# nodejs and curl for downloading setup-cpp
RUN dnf -y install nodejs npm curl git
# install pnpm
RUN npm install -g pnpm
RUN dnf -y install nodejs npm curl git && dnf clean all \
&& npm install -g pnpm
#### Building

View File

@ -2,11 +2,10 @@
FROM ubuntu:22.04 as base
# install setup-cpp
RUN apt-get update -qq && apt-get install -y --no-install-recommends npm git curl
RUN npm install -g setup-cpp
RUN apt-get update -qq && apt-get install -y --no-install-recommends npm git curl && rm -rf /var/lib/apt/lists/* \
&& npm install -g setup-cpp \
# install llvm, cmake, ninja, and ccache
RUN setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
&& setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --task true
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]

View File

@ -1,62 +0,0 @@
FROM ubuntu:20.04 as base
# set time-zone
ENV TZ=Canada/Pacific
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# install node with nvm
RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates
ARG nvm_version="0.39.3"
ARG node_version="16.20.0"
RUN mkdir /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /nvm_install.sh
RUN chmod +x /nvm_install.sh && /nvm_install.sh \
&& . $NVM_DIR/nvm.sh \
&& nvm install $node_version \
&& nvm alias default $node_version \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH
# install pnpm
ENV PNPM_VERSION "7.32.0"
ADD https://get.pnpm.io/install.sh /tmp/pnpm_install.sh
RUN chmod +x /tmp/pnpm_install.sh && bash /tmp/pnpm_install.sh
ENV PNPM_HOME "/root/.local/share/pnpm"
ENV PATH "${PATH}:${PNPM_HOME}"
#### Building
FROM base AS builder
## https://github.com/ever0de/pnpm-docker-root-bug#how-to-fix
WORKDIR /workspace
COPY . .
RUN pnpm install
#### setup-cpp
FROM base AS setup-cpp
# add setup-cpp.js
COPY --from=builder /workspace/dist/node16 /
# run installation
RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]
#### Building (example)
FROM setup-cpp AS example-builder
COPY ./dev/cpp_vcpkg_project /home/app
WORKDIR /home/app
RUN bash -c 'source ~/.cpprc \
&& task build'
#### Running environment
# use a distroless image or ubuntu:22.04 if you wish
FROM gcr.io/distroless/cc as runner
# copy the built binaries and their runtime dependencies
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
WORKDIR /home/app/
ENTRYPOINT ["./my_exe"]

View File

@ -1,63 +0,0 @@
FROM ubuntu:20.04 as base
# set time-zone
ENV TZ=Canada/Pacific
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# install node with nvm
RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates
ARG nvm_version="0.39.3"
ARG node_version="12.22.12"
RUN mkdir /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /nvm_install.sh
RUN chmod +x /nvm_install.sh && /nvm_install.sh \
&& . $NVM_DIR/nvm.sh \
&& nvm install $node_version \
&& nvm alias default $node_version \
&& nvm use default
ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH
# install pnpm
ENV PNPM_VERSION "6.35.1"
ADD https://get.pnpm.io/install.sh /tmp/pnpm_install.sh
RUN chmod +x /tmp/pnpm_install.sh && bash /tmp/pnpm_install.sh
ENV PNPM_HOME "/root/.local/share/pnpm"
ENV PATH "${PATH}:${PNPM_HOME}"
#### Building
FROM base AS builder
## https://github.com/ever0de/pnpm-docker-root-bug#how-to-fix
WORKDIR /workspace
COPY . .
## WARN "prepare" script of "setup-cpp" inside "/workspace" is skipped as the working directory seems suspicious. To run this lifecycle script anyway, use "--unsafe-perm".
RUN pnpm install --unsafe-perm
#### setup-cpp
FROM base AS setup-cpp
# add setup-cpp.js
COPY --from=builder /workspace/dist/node12 /
# run installation
RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]
#### Building (example)
FROM setup-cpp AS example-builder
COPY ./dev/cpp_vcpkg_project /home/app
WORKDIR /home/app
RUN bash -c 'source ~/.cpprc \
&& task build'
#### Running environment
# use a distroless image or ubuntu:22.04 if you wish
FROM gcr.io/distroless/cc as runner
# copy the built binaries and their runtime dependencies
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
WORKDIR /home/app/
ENTRYPOINT ["./my_exe"]

View File

@ -1,11 +1,11 @@
FROM ubuntu:22.04 AS base
# install node with nvm
RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates
RUN apt-get update -qq && apt-get install -y --no-install-recommends git curl wget ca-certificates && rm -rf /var/lib/apt/lists/*
ARG nvm_version="0.39.3"
ARG node_version="18.15.0"
RUN mkdir /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
RUN mkdir $NVM_DIR
ADD https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh /tmp/nvm_install.sh
RUN chmod +x /tmp/nvm_install.sh && /tmp/nvm_install.sh \
&& . $NVM_DIR/nvm.sh \
@ -16,10 +16,7 @@ ENV NODE_PATH $NVM_DIR/v${node_version}/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v${node_version}/bin:$PATH
# install pnpm
ADD https://get.pnpm.io/install.sh /tmp/pnpm_install.sh
RUN chmod +x /tmp/pnpm_install.sh && bash /tmp/pnpm_install.sh
ENV PNPM_HOME "/root/.local/share/pnpm"
ENV PATH "${PATH}:${PNPM_HOME}"
RUN npm install -g pnpm
#### Building
@ -35,7 +32,7 @@ FROM base AS setup-cpp
# add setup-cpp.js
COPY --from=builder /workspace/dist/node18 /
# run installation
RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
RUN . "${NVM_DIR}/nvm.sh" && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]

View File

@ -1,40 +0,0 @@
FROM ubuntu:22.04 AS base
RUN apt-get update -qq && apt-get install -y --no-install-recommends nodejs npm
# install pnpm
RUN npm install -g pnpm@6.35.1
#### Building
FROM base AS builder
## https://github.com/ever0de/pnpm-docker-root-bug#how-to-fix
WORKDIR /workspace
COPY . .
RUN pnpm install
#### setup-cpp
FROM base AS setup-cpp
# add setup-cpp.js
COPY --from=builder /workspace/dist/node12 /
# run installation
RUN . $NVM_DIR/nvm.sh && node /setup-cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true --powershell true
CMD ["source", "~/.cpprc"]
ENTRYPOINT ["/bin/bash"]
#### Building (example)
FROM setup-cpp AS example-builder
COPY ./dev/cpp_vcpkg_project /home/app
WORKDIR /home/app
RUN bash -c 'source ~/.cpprc \
&& task build'
#### Running environment
# use a distroless image or ubuntu:22.04 if you wish
FROM gcr.io/distroless/cc as runner
# copy the built binaries and their runtime dependencies
COPY --from=example-builder /home/app/build/my_exe/Release/ /home/app/
WORKDIR /home/app/
ENTRYPOINT ["./my_exe"]