addon-base/base/Dockerfile
Franck Nijhof 139cea17f0
Add CI based on GitHub Actions (#52)
* Add CI based on GitHub Actions

* Prettified Code!

* Add basic add-on config

* Process add-on lint warnings

* Fix QEMU User Static binary conditions

* Fix expression

* Resolving missing target variable

* Add deployment

* Cleanup

Co-authored-by: frenck <frenck@users.noreply.github.com>
2021-01-14 02:13:18 +01:00

98 lines
3.2 KiB
Docker

ARG BUILD_FROM=alpine:3.12.1
# hadolint ignore=DL3006
FROM ${BUILD_FROM}
# Environment variables
ENV \
HOME="/root" \
LANG="C.UTF-8" \
PS1="$(whoami)@$(hostname):$(pwd)$ " \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_WAIT_FOR_SERVICES=1 \
TERM="xterm-256color"
# Copy root filesystem
COPY rootfs /
# Set shell
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
# Install base system
ARG BUILD_ARCH=amd64
RUN \
set -o pipefail \
\
&& echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories \
&& echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories \
&& echo '@edge http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories \
\
&& apk add --no-cache --virtual .build-dependencies \
tar=1.32-r1 \
\
&& apk add --no-cache \
libcrypto1.1=1.1.1g-r0 \
libssl1.1=1.1.1g-r0 \
musl-utils=1.1.24-r10 \
musl=1.1.24-r10 \
\
&& apk add --no-cache \
bash=5.0.17-r0 \
curl=7.69.1-r3 \
jq=1.6-r1 \
tzdata=2020f-r0 \
\
&& S6_ARCH="${BUILD_ARCH}" \
&& if [ "${BUILD_ARCH}" = "i386" ]; then S6_ARCH="x86"; fi \
&& if [ "${BUILD_ARCH}" = "armv7" ]; then S6_ARCH="arm"; fi \
\
&& curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v2.1.0.2/s6-overlay-${S6_ARCH}.tar.gz" \
| tar zxvf - -C / \
\
&& mkdir -p /etc/fix-attrs.d \
&& mkdir -p /etc/services.d \
\
&& curl -J -L -o /tmp/bashio.tar.gz \
"https://github.com/hassio-addons/bashio/archive/v0.9.0.tar.gz" \
&& mkdir /tmp/bashio \
&& tar zxvf \
/tmp/bashio.tar.gz \
--strip 1 -C /tmp/bashio \
\
&& mv /tmp/bashio/lib /usr/lib/bashio \
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
\
&& apk del --no-cache --purge .build-dependencies \
&& rm -f -r \
/tmp/*
# Entrypoint & CMD
ENTRYPOINT ["/init"]
# Build arugments
ARG BUILD_DATE
ARG BUILD_REF
ARG BUILD_VERSION
ARG BUILD_REPOSITORY
# Labels
LABEL \
io.hass.name="Addon base for ${BUILD_ARCH}" \
io.hass.description="Home Assistant Community Add-on: ${BUILD_ARCH} base image" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="base" \
io.hass.version=${BUILD_VERSION} \
io.hass.base.version=${BUILD_VERSION} \
io.hass.base.name="alpine" \
io.hass.base.image="hassioaddons/base" \
maintainer="Franck Nijhof <frenck@addons.community>" \
org.opencontainers.image.title="Addon base for ${BUILD_ARCH}" \
org.opencontainers.image.description="Home Assistant Community Add-on: ${BUILD_ARCH} Base image" \
org.opencontainers.image.vendor="Home Assistant Community Add-ons" \
org.opencontainers.image.authors="Franck Nijhof <frenck@addons.community>" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://addons.community" \
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}