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

167 lines
4.2 KiB
Text
Raw Permalink Normal View History

2021-02-17 16:04:47 +01:00
#syntax=docker/dockerfile:1.2-labs
2021-01-08 22:58:49 +01:00
# Alpine Dockerfile
2020-11-11 22:16:19 +01:00
#
# @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/>.
###################################################################################
2021-02-16 14:42:05 +01:00
FROM alpine:3.13.1 AS dev
2020-11-11 22:16:19 +01:00
ARG DISTRO=alpine
ARG ARCH=x86_64
ARG TRIPLET=x86_64-alpine-linux-musl
2020-11-11 22:16:19 +01:00
# Toolchain
RUN apk update && \
apk add gcc g++ \
pkgconf cmake make \
autoconf automake libtool \
2020-11-12 01:16:33 +01:00
git mercurial \
2020-11-11 22:16:19 +01:00
flex bison \
2020-11-12 01:16:33 +01:00
protobuf \
file
2020-11-11 22:16:19 +01:00
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 \
2021-02-19 01:54:21 +01:00
libusb-dev \
lua-dev
2020-11-11 22:16:19 +01:00
RUN if [ "${ARCH}" != "armv6" -a "${ARCH}" != "armv7" ]; then \
apk add \
nanomsg-dev@testing; \
fi
2020-11-11 22:16:19 +01:00
2020-11-12 01:16:33 +01:00
# 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
2020-11-11 22:16:19 +01:00
# Install unpackaged dependencies from source
2020-11-12 01:16:33 +01:00
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
2021-02-17 16:04:47 +01:00
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 && \
2020-11-12 01:16:33 +01:00
ldconfig.orig /usr/local/lib /usr/lib
FROM dev AS builder
2020-11-11 22:16:19 +01:00
COPY . /villas/
RUN mkdir -p /villas/build
WORKDIR /villas/build
2021-02-17 16:04:47 +01:00
RUN --security=insecure \
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} \
2020-11-12 01:16:33 +01:00
-DCMAKE_PREFIX_PATH=${PREFIX} .. && \
2021-01-08 22:58:49 +01:00
make -j8 install
2020-11-11 22:16:19 +01:00
2020-11-12 01:16:33 +01:00
FROM alpine:edge AS app
ARG DISTRO=alpine
ARG ARCH=x86_64
ARG TRIPLET=x86_64-alpine-linux-musl
2020-11-12 01:16:33 +01:00
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
2020-11-11 22:16:19 +01:00
2021-02-17 16:04:47 +01:00
RUN apk update
2020-11-11 22:16:19 +01:00
RUN apk add \
2021-02-17 16:04:47 +01:00
openssl \
libconfig \
curl \
jansson \
spdlog \
fmt \
libnl3 \
graphviz \
protobuf \
protobuf-c \
zeromq \
rabbitmq-c \
mosquitto \
libusb \
2021-02-19 01:54:21 +01:00
ossp-uuid@testing \
lua
2020-11-11 22:16:19 +01:00
RUN if [ "${ARCH}" != "armv6" -a "${ARCH}" != "armv7" ]; then \
apk add \
nanomsg@testing; \
fi
2020-11-12 01:16:33 +01:00
COPY --from=builder /app /app
RUN ldconfig /app/lib /app/lib64
ENV LD_LIBRARY_PATH=/app/lib:/app/lib64
ENV PATH=/app/bin:${PATH}
2020-12-04 13:37:25 +01:00
# Test if it runs
2021-02-17 16:04:47 +01:00
RUN /app/bin/villas-node -h 2>&1 > /dev/null
2020-12-04 13:37:25 +01:00
ARG GIT_REV=unknown
ARG GIT_BRANCH=unknown
ARG VERSION=unknown
2020-11-11 22:16:19 +01:00
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"
2020-11-12 01:16:33 +01:00
ENTRYPOINT ["villas"]