summaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2024-02-04 17:22:31 +0900
committerRyo Nakamura <upa@haeena.net>2024-02-04 17:22:31 +0900
commitec663cc966f65c75b3a7fe463043dd3685686e65 (patch)
tree5405072d24a4d80445e30ea407a1fd13535422b6 /Dockerfile
parentd57ed4149d0e3bbcc09793bc00c6bd34fd2ca1fb (diff)
bump up container image versions and drop using CPack
We have already provided DEB packages in launchpad PPA and RPM packages in COPR. Thus, we need no more deb/rpm packages in Github releases. The single binary build of mscp is an execptio. Updated container image versions: - almalinux 8.8 -> 9.3 - rocky 8.8 -> 8.9, and 9.3 is added - alpine 3.17 -> 3.19
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile/.gitignore3
-rw-r--r--Dockerfile/README.md19
-rw-r--r--Dockerfile/almalinux-9.3.Dockerfile29
-rw-r--r--Dockerfile/alpine-3.19.Dockerfile35
-rw-r--r--Dockerfile/build-deb.Dockerfile20
-rw-r--r--Dockerfile/build-srpm.Dockerfile22
-rw-r--r--Dockerfile/build-srpm.Dockerfile.in22
-rw-r--r--Dockerfile/rocky-8.9.Dockerfile29
-rw-r--r--Dockerfile/rocky-9.3.Dockerfile30
-rw-r--r--Dockerfile/ubuntu-20.04.Dockerfile35
-rw-r--r--Dockerfile/ubuntu-22.04.Dockerfile33
11 files changed, 277 insertions, 0 deletions
diff --git a/Dockerfile/.gitignore b/Dockerfile/.gitignore
new file mode 100644
index 0000000..f7083c9
--- /dev/null
+++ b/Dockerfile/.gitignore
@@ -0,0 +1,3 @@
+
+# generated by cmake
+rpmbuild.Dockerfile
diff --git a/Dockerfile/README.md b/Dockerfile/README.md
new file mode 100644
index 0000000..e901664
--- /dev/null
+++ b/Dockerfile/README.md
@@ -0,0 +1,19 @@
+
+Dockerfiles for building and testing mscp.
+
+Build container:
+
+```
+docker build -t mscp-DIST:VER -f docker/DIST-VER.Dockerfile .
+```
+
+Run test:
+
+```
+docker run --init --rm mscp-DST:VER /mscp/scripts/test-in-container.sh
+```
+
+`cmake` provides custom targets to build and test mscp in the
+containers. See `make docker-*` targets. `make docker-build-all`
+builds all container images and `make docker-test-all` runs the test
+in all container images. \ No newline at end of file
diff --git a/Dockerfile/almalinux-9.3.Dockerfile b/Dockerfile/almalinux-9.3.Dockerfile
new file mode 100644
index 0000000..516fbd2
--- /dev/null
+++ b/Dockerfile/almalinux-9.3.Dockerfile
@@ -0,0 +1,29 @@
+FROM almalinux:9.3
+
+# install pytest, sshd for test, and rpm-build
+RUN set -ex && yum -y install \
+ python3 python3-pip python3-devel openssh openssh-server openssh-clients rpm-build
+
+RUN python3 -m pip install pytest
+
+
+# preparation for sshd
+RUN mkdir /var/run/sshd \
+ && ssh-keygen -A \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+# build
+RUN cd ${mscpdir} \
+ && rm -rf build \
+ && cmake -B build \
+ && cd ${mscpdir}/build \
+ && make -j 2 \
+ && make install
diff --git a/Dockerfile/alpine-3.19.Dockerfile b/Dockerfile/alpine-3.19.Dockerfile
new file mode 100644
index 0000000..a19957b
--- /dev/null
+++ b/Dockerfile/alpine-3.19.Dockerfile
@@ -0,0 +1,35 @@
+FROM alpine:3.19
+
+# Build mscp with conan to create single binary mscp
+
+RUN apk add --no-cache \
+ gcc make cmake python3 py3-pip perl linux-headers libc-dev \
+ openssh bash python3-dev py3-pytest g++
+
+RUN pip3 install --break-system-packages conan
+
+# preparation for sshd
+RUN ssh-keygen -A
+RUN mkdir /var/run/sshd \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+
+
+# Build mscp as a single binary
+RUN conan profile detect --force
+
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
+
+RUN cd ${mscpdir} \
+ && rm -rf build \
+ && conan install . --output-folder=build --build=missing \
+ && cd ${mscpdir}/build \
+ && cmake .. \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake \
+ -DBUILD_CONAN=ON -DBUILD_STATIC=ON \
+ && make -j 2 \
+ && make install
+
diff --git a/Dockerfile/build-deb.Dockerfile b/Dockerfile/build-deb.Dockerfile
new file mode 100644
index 0000000..e3e6381
--- /dev/null
+++ b/Dockerfile/build-deb.Dockerfile
@@ -0,0 +1,20 @@
+FROM ubuntu:22.04
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \
+ ca-certificates build-essential devscripts debhelper gcc make cmake
+
+ARG mscpdir="/debbuild/mscp"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+# build
+RUN cd ${mscpdir} \
+ && debuild -us -uc \
+ && mv ${mscpdir} /
+
+# Then all debuild output files exsit at /debbuild
+
diff --git a/Dockerfile/build-srpm.Dockerfile b/Dockerfile/build-srpm.Dockerfile
new file mode 100644
index 0000000..b614fc1
--- /dev/null
+++ b/Dockerfile/build-srpm.Dockerfile
@@ -0,0 +1,22 @@
+FROM rockylinux:9
+
+# install pytest, sshd for test, and rpm-build
+RUN set -ex && yum -y install rpm-build rpmdevtools
+
+ARG mscpdir="/mscp-0.1.3"
+ARG mscptgz="mscp-0.1.3.tar.gz"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+# prepare rpmbuild
+RUN rpmdev-setuptree \
+ && rm -rf ${mscpdir}/build \
+ && tar zcvf /${mscptgz} --exclude-vcs ${mscpdir} \
+ && cp /${mscptgz} ~/rpmbuild/SOURCES/ \
+ && cp ${mscpdir}/rpm/mscp.spec ~/rpmbuild/SPECS/
+
+# build rpm and src.rpm
+RUN rpmbuild -ba ~/rpmbuild/SPECS/mscp.spec
diff --git a/Dockerfile/build-srpm.Dockerfile.in b/Dockerfile/build-srpm.Dockerfile.in
new file mode 100644
index 0000000..f7a8cf0
--- /dev/null
+++ b/Dockerfile/build-srpm.Dockerfile.in
@@ -0,0 +1,22 @@
+FROM rockylinux:9
+
+# install pytest, sshd for test, and rpm-build
+RUN set -ex && yum -y install rpm-build rpmdevtools
+
+ARG mscpdir="/mscp-@MSCP_VERSION@"
+ARG mscptgz="mscp-@MSCP_VERSION@.tar.gz"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+# prepare rpmbuild
+RUN rpmdev-setuptree \
+ && rm -rf ${mscpdir}/build \
+ && tar zcvf /${mscptgz} --exclude-vcs ${mscpdir} \
+ && cp /${mscptgz} ~/rpmbuild/SOURCES/ \
+ && cp ${mscpdir}/rpm/mscp.spec ~/rpmbuild/SPECS/
+
+# build rpm and src.rpm
+RUN rpmbuild -ba ~/rpmbuild/SPECS/mscp.spec
diff --git a/Dockerfile/rocky-8.9.Dockerfile b/Dockerfile/rocky-8.9.Dockerfile
new file mode 100644
index 0000000..cb2de9f
--- /dev/null
+++ b/Dockerfile/rocky-8.9.Dockerfile
@@ -0,0 +1,29 @@
+FROM rockylinux:8.9
+
+# install pytest, sshd for test, and rpm-build
+RUN set -ex && yum -y install \
+ python3 python3-pip python3-devel openssh openssh-server openssh-clients rpm-build
+
+RUN python3 -m pip install pytest
+
+
+# preparation for sshd
+RUN mkdir /var/run/sshd \
+ && ssh-keygen -A \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+# build
+RUN cd ${mscpdir} \
+ && rm -rf build \
+ && cmake -B build \
+ && cd ${mscpdir}/build \
+ && make -j 2 \
+ && make install
diff --git a/Dockerfile/rocky-9.3.Dockerfile b/Dockerfile/rocky-9.3.Dockerfile
new file mode 100644
index 0000000..84f6b11
--- /dev/null
+++ b/Dockerfile/rocky-9.3.Dockerfile
@@ -0,0 +1,30 @@
+FROM rockylinux:9.3
+
+# install pytest, sshd for test, and rpm-build
+RUN set -ex && yum -y install \
+ python3 python3-pip python3-devel openssh openssh-server openssh-clients rpm-build
+
+RUN python3 -m pip install pytest
+
+
+# preparation for sshd
+RUN mkdir /var/run/sshd \
+ && ssh-keygen -A \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+# build
+RUN cd ${mscpdir} \
+ && rm -rf build \
+ && cmake -B build \
+ && cd ${mscpdir}/build \
+ && make -j 2 \
+ && make install
+
diff --git a/Dockerfile/ubuntu-20.04.Dockerfile b/Dockerfile/ubuntu-20.04.Dockerfile
new file mode 100644
index 0000000..a2dda99
--- /dev/null
+++ b/Dockerfile/ubuntu-20.04.Dockerfile
@@ -0,0 +1,35 @@
+FROM ubuntu:20.04
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \
+ ca-certificates
+
+# install pytest, and sshd for test
+RUN apt-get install -y --no-install-recommends \
+ python3 python3-pip python3-dev openssh-server
+
+RUN python3 -m pip install pytest
+
+
+# preparation for sshd
+RUN mkdir /var/run/sshd \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+
+
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+
+# build
+RUN cd ${mscpdir} \
+ && rm -rf build \
+ && cmake -B build \
+ && cd ${mscpdir}/build \
+ && make -j 2 \
+ && make install
+
diff --git a/Dockerfile/ubuntu-22.04.Dockerfile b/Dockerfile/ubuntu-22.04.Dockerfile
new file mode 100644
index 0000000..1a8fb12
--- /dev/null
+++ b/Dockerfile/ubuntu-22.04.Dockerfile
@@ -0,0 +1,33 @@
+FROM ubuntu:22.04
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \
+ ca-certificates
+
+# install pytest, and sshd for test
+RUN apt-get install -y --no-install-recommends \
+ python3 python3-pip python3-dev openssh-server
+
+RUN python3 -m pip install pytest
+
+
+# preparation for sshd
+RUN mkdir /var/run/sshd \
+ && ssh-keygen -f /root/.ssh/id_rsa -N "" \
+ && mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
+
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
+
+# install build dependency
+RUN ${mscpdir}/scripts/install-build-deps.sh
+
+
+# build
+RUN cd ${mscpdir} \
+ && rm -rf build \
+ && cmake -B build \
+ && cd ${mscpdir}/build \
+ && make -j 2 \
+ && make install