add install-build-deps.sh and fix docker build procedure

This commit is contained in:
Ryo Nakamura
2022-11-05 21:26:34 +09:00
parent 6e6e5066c7
commit fc56c53d04
7 changed files with 65 additions and 31 deletions

2
docker/.gitignore vendored
View File

@@ -1,2 +0,0 @@
*.deb
*.rpm

View File

@@ -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

View File

@@ -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 cd ${workdir} \
&& git clone --depth=1 https://github.com/upa/mscp \
&& mkdir mscp/build && cd mscp/build \
&& cmake .. -DBUILD_PKG=1 \
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 DEB CPackConfig.cmake

View File

@@ -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 cd ${workdir} \
&& git clone --depth=1 https://github.com/upa/mscp \
&& mkdir mscp/build && cd mscp/build \
&& cmake .. -DBUILD_PKG=1 \
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 DEB CPackConfig.cmake

View File

@@ -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/
```