mirror of
https://github.com/upa/mscp.git
synced 2026-02-04 03:24:58 +08:00
add alpine docker to build mscp as a single binary
The build recipe in docker/alpine-3.17.Dockerfile uses conan to build mscp as a single binary (with statically linked musl). Now the mscp binary is portable!
This commit is contained in:
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@@ -49,6 +49,7 @@ jobs:
|
||||
${{github.workspace}}/build/mscp_${{env.VERSION}}-ubuntu-22.04-x86_64.deb
|
||||
${{github.workspace}}/build/mscp_${{env.VERSION}}-centos-8-x86_64.rpm
|
||||
${{github.workspace}}/build/mscp_${{env.VERSION}}-rocky-8.6-x86_64.rpm
|
||||
${{github.workspace}}/build/mscp_${{env.VERSION}}-apline-3.17-x86_64.static
|
||||
|
||||
source-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -129,9 +129,9 @@ include(CPack)
|
||||
# Custom targets to build and test mscp in docker containers.
|
||||
# foreach(IN ZIP_LISTS) (cmake >= 3.17) can shorten the following lists.
|
||||
# However, ubuntu 20.04 has cmake 3.16.3. So this is a roundabout trick.
|
||||
list(APPEND DIST_NAMES ubuntu ubuntu centos rocky)
|
||||
list(APPEND DIST_VERS 20.04 22.04 8 8.6)
|
||||
list(APPEND DIST_PKGS deb deb rpm rpm)
|
||||
list(APPEND DIST_NAMES ubuntu ubuntu centos rocky alpine)
|
||||
list(APPEND DIST_VERS 20.04 22.04 8 8.6 3.17)
|
||||
list(APPEND DIST_PKGS deb deb rpm rpm static)
|
||||
|
||||
list(LENGTH DIST_NAMES _DIST_LISTLEN)
|
||||
math(EXPR DIST_LISTLEN "${_DIST_LISTLEN} - 1")
|
||||
|
||||
35
docker/alpine-3.17.Dockerfile
Normal file
35
docker/alpine-3.17.Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
FROM alpine:3.17
|
||||
|
||||
# Build mscp with conan to create single binary mscp
|
||||
|
||||
ARG mscpdir="/mscp"
|
||||
|
||||
COPY . ${mscpdir}
|
||||
|
||||
RUN apk add --no-cache \
|
||||
gcc make cmake python3 py3-pip perl linux-headers libc-dev \
|
||||
openssh bash python3-dev g++
|
||||
|
||||
RUN pip3 install conan pytest numpy
|
||||
|
||||
# Build mscp as a single binary
|
||||
RUN conan profile detect --force
|
||||
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_STATIC=ON -DBUILD_CONAN=ON \
|
||||
&& make \
|
||||
&& cp mscp /usr/bin/ \
|
||||
&& cp mscp /mscp/build/mscp_0.0.6-alpine-3.17-x86_64.static
|
||||
|
||||
# copy mscp to PKG FILE NAME because this build doesn't use CPACK
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user