summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2022-11-05 21:26:34 +0900
committerRyo Nakamura <upa@haeena.net>2022-11-05 21:26:34 +0900
commitfc56c53d04d7e499a91d0526842a6072477ddb96 (patch)
tree3675ef7d3b2f904b843f1c969b0f9b110c458724 /docker
parent6e6e5066c7ad83ad2daf8f8ccbe7231211e41c97 (diff)
add install-build-deps.sh and fix docker build procedure
Diffstat (limited to 'docker')
-rw-r--r--docker/.gitignore2
-rw-r--r--docker/Dockerfile-centos-822
-rw-r--r--docker/Dockerfile-ubuntu-20.0418
-rw-r--r--docker/Dockerfile-ubuntu-22.0418
-rw-r--r--docker/README.md8
5 files changed, 43 insertions, 25 deletions
diff --git a/docker/.gitignore b/docker/.gitignore
deleted file mode 100644
index 7fcc085..0000000
--- a/docker/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.deb
-*.rpm
diff --git a/docker/Dockerfile-centos-8 b/docker/Dockerfile-centos-8
index 7c80119..8deae76 100644
--- a/docker/Dockerfile-centos-8
+++ b/docker/Dockerfile-centos-8
@@ -1,7 +1,8 @@
FROM centos:8
-ARG DEBIAN_FRONTEND=noninteractive
-ARG workdir="/"
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
# from https://stackoverflow.com/questions/70963985/error-failed-to-download-metadata-for-repo-appstream-cannot-prepare-internal
RUN cd /etc/yum.repos.d/
@@ -9,10 +10,15 @@ RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN set -ex && yum -y update && yum -y install \
- git cmake gcc make libssh-devel rpm-build
+ rpm-build
+
+RUN ${mscpdir}/install-build-deps.sh
+
+RUN cd ${mscpdir} \
+ && rm -rf build
+
+RUN cd ${mscpdir} \
+ && cmake -B build -DBUILD_PKG=1 \
+ && cd ${mscpdir}/build \
+ &&cpack -G RPM CPackConfig.cmake
-RUN cd ${workdir} \
- && git clone --depth=1 https://github.com/upa/mscp \
- && mkdir mscp/build && cd mscp/build \
- && cmake .. -DBUILD_PKG=1 \
- && cpack -G RPM CPackConfig.cmake
diff --git a/docker/Dockerfile-ubuntu-20.04 b/docker/Dockerfile-ubuntu-20.04
index d48d4f1..687072c 100644
--- a/docker/Dockerfile-ubuntu-20.04
+++ b/docker/Dockerfile-ubuntu-20.04
@@ -1,13 +1,19 @@
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
-ARG workdir="/"
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \
- git cmake build-essential libssh-dev ca-certificates
+ ca-certificates
+
+RUN ${mscpdir}/install-build-deps.sh
+
+RUN cd ${mscpdir} \
+ && rm -rf build
-RUN cd ${workdir} \
- && git clone --depth=1 https://github.com/upa/mscp \
- && mkdir mscp/build && cd mscp/build \
- && cmake .. -DBUILD_PKG=1 \
+RUN cd ${mscpdir} \
+ && cmake -B build -DBUILD_PKG=1 \
+ && cd ${mscpdir}/build \
&& cpack -G DEB CPackConfig.cmake
diff --git a/docker/Dockerfile-ubuntu-22.04 b/docker/Dockerfile-ubuntu-22.04
index eb89243..59a57d2 100644
--- a/docker/Dockerfile-ubuntu-22.04
+++ b/docker/Dockerfile-ubuntu-22.04
@@ -1,13 +1,19 @@
FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive
-ARG workdir="/"
+ARG mscpdir="/mscp"
+
+COPY . ${mscpdir}
RUN set -ex && apt-get update && apt-get install -y --no-install-recommends \
- git cmake build-essential libssh-dev ca-certificates
+ ca-certificates
+
+RUN ${mscpdir}/install-build-deps.sh
+
+RUN cd ${mscpdir} \
+ && rm -rf build
-RUN cd ${workdir} \
- && git clone --depth=1 https://github.com/upa/mscp \
- && mkdir mscp/build && cd mscp/build \
- && cmake .. -DBUILD_PKG=1 \
+RUN cd ${mscpdir} \
+ && cmake -B build -DBUILD_PKG=1 \
+ && cd ${mscpdir}/build \
&& cpack -G DEB CPackConfig.cmake
diff --git a/docker/README.md b/docker/README.md
index 07279c3..872d73f 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -2,15 +2,17 @@
Build `mscp` in docker containers.
```console
-docker build -t mscp-ubuntu:20.04 -f Dockerfile-ubuntu-20.04 .
+cd ..
+
+docker build -t mscp-ubuntu:20.04 -f docker/Dockerfile-ubuntu-20.04 .
docker run -it --rm -v (pwd):/out mscp-ubuntu:20.04 \
cp /mscp/build/mscp_0.0.0-ubuntu-20.04-x86_64.deb /out/
-docker build -t mscp-ubuntu:22.04 -f Dockerfile-ubuntu-22.04 .
+docker build -t mscp-ubuntu:22.04 -f docker/Dockerfile-ubuntu-22.04 .
docker run -it --rm -v (pwd):/out mscp-ubuntu:22.04 \
cp /mscp/build/mscp_0.0.0-ubuntu-22.04-x86_64.deb /out/
-docker build -t mscp-centos:8 -f Dockerfile-centos-8 .
+docker build -t mscp-centos:8 -f docker/Dockerfile-centos-8 .
docker run -it --rm -v (pwd):/out mscp-centos:8 \
cp /mscp/build/mscp_0.0.0-centos-8-x86_64.rpm /out/
```