1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-16 00:00:02 +01:00
VILLASnode/packaging/docker/Dockerfile.alpine

166 lines
4.2 KiB
Text

#syntax=docker/dockerfile:1.2-labs
# Alpine Dockerfile
#
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
# @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
# @license GNU General Public License (version 3)
#
# VILLASnode
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###################################################################################
FROM alpine:3.13.1 AS dev
ARG DISTRO=alpine
ARG ARCH=x86_64
ARG TRIPLET=x86_64-alpine-linux-musl
# Toolchain
RUN apk update && \
apk add gcc g++ \
pkgconf cmake make \
autoconf automake libtool \
git mercurial \
flex bison \
protobuf \
file
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
# Dependencies
RUN apk update && \
apk add \
openssl-dev \
ossp-uuid-dev@testing \
libconfig-dev \
curl-dev \
jansson-dev \
spdlog-dev \
fmt-dev \
libnl3-dev \
graphviz-dev \
protobuf-dev \
protobuf-c-dev \
zeromq-dev \
rabbitmq-c-dev \
mosquitto-dev \
libusb-dev \
lua-dev
RUN if [ "${ARCH}" != "armv6" -a "${ARCH}" != "armv7" ]; then \
apk add \
nanomsg-dev@testing; \
fi
# Some fixes for Alpine
RUN echo -e "#!/bin/sh\n" | \
tee /usr/bin/udevadm | \
tee /bin/ldconfig && \
chmod +x /usr/bin/udevadm /bin/ldconfig && \
mv /sbin/ldconfig /sbin/ldconfig.orig
ENV PREFIX=/app
RUN mkdir /app
# Install unpackaged dependencies from source
ADD packaging/deps.sh /
# Disabling a few dependencies due to incompatability with musl-libc:
# https://github.com/creytiv/re/issues/256
# https://github.com/mz-automation/libiec61850/issues/279
RUN --security=insecure \
export SKIP_CRITERION=1; \
export SKIP_ETHERLAB=1; \
export SKIP_LIBRE=1; \
if [ "${ARCH}" == "armv6" -o "${ARCH}" == "armv7" ]; then \
export SKIP_COMEDILIB=1; \
export SKIP_ULDAQ=1; \
fi; \
bash deps.sh && \
ldconfig.orig /usr/local/lib /usr/lib
FROM dev AS builder
COPY . /villas/
RUN mkdir -p /villas/build
WORKDIR /villas/build
RUN --security=insecure \
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_PREFIX_PATH=${PREFIX} .. && \
make -j8 install
FROM alpine:edge AS app
ARG DISTRO=alpine
ARG ARCH=x86_64
ARG TRIPLET=x86_64-alpine-linux-musl
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk update
RUN apk add \
openssl \
libconfig \
curl \
jansson \
spdlog \
fmt \
libnl3 \
graphviz \
protobuf \
protobuf-c \
zeromq \
rabbitmq-c \
mosquitto \
libusb \
ossp-uuid@testing \
lua
RUN if [ "${ARCH}" != "armv6" -a "${ARCH}" != "armv7" ]; then \
apk add \
nanomsg@testing; \
fi
COPY --from=builder /app /app
RUN ldconfig /app/lib /app/lib64
ENV LD_LIBRARY_PATH=/app/lib:/app/lib64
ENV PATH=/app/bin:${PATH}
# Test if it runs
RUN /app/bin/villas-node -h 2>&1 > /dev/null
ARG GIT_REV=unknown
ARG GIT_BRANCH=unknown
ARG VERSION=unknown
LABEL \
org.label-schema.schema-version="1.0" \
org.label-schema.name="VILLASnode" \
org.label-schema.license="GPL-3.0" \
org.label-schema.vcs-ref="$GIT_REV" \
org.label-schema.vcs-branch="$GIT_BRANCH" \
org.label-schema.version="$VERSION" \
org.label-schema.vendor="Institute for Automation of Complex Power Systems, RWTH Aachen University" \
org.label-schema.author.name="Steffen Vogel" \
org.label-schema.author.email="stvogel@eonerc.rwth-aachen.de" \
org.label-schema.description="A image containing all build-time dependencies for VILLASnode based on Fedora" \
org.label-schema.url="http://fein-aachen.org/projects/villas-framework/" \
org.label-schema.vcs-url="https://git.rwth-aachen.de/acs/public/villas/node" \
org.label-schema.usage="https://villas.fein-aachen.org/doc/node-installation.html#node-installation-docker"
ENTRYPOINT ["villas"]