first try
This commit is contained in:
89
Dockerfile
89
Dockerfile
@@ -1,27 +1,80 @@
|
||||
# Example Dockerfile for amd64
|
||||
ARG BASE_IMAGE=alpine:latest
|
||||
# syntax=docker/dockerfile:1
|
||||
ARG BUILD_BASE_IMAGE
|
||||
FROM ${BUILD_BASE_IMAGE}
|
||||
|
||||
FROM ${BASE_IMAGE}
|
||||
ARG BUILD_APP_VERSION
|
||||
ARG BUILD_S6_ARCH_amd64
|
||||
ARG BUILD_S6_OVERLAY_VERSION
|
||||
ARG BUILD_DATE
|
||||
ARG MODS_VERSION="v3"
|
||||
ARG PKG_INST_VERSION="v1"
|
||||
ARG LSIOWN_VERSION="v1"
|
||||
ARG WITHCONTENV_VERSION="v1"
|
||||
ARG BUILD_APP_USER
|
||||
ARG BUILD_APP_UID
|
||||
ARG BUILD_APP_GID
|
||||
ARG BUILD_MAINTAINER
|
||||
|
||||
ARG MAINTAINER
|
||||
ARG TZ
|
||||
ARG APP_NAME
|
||||
ARG APP_USER
|
||||
LABEL build_version="${BUILD_MAINTAINER} version: ${BUILD_APP_VERSION} Build-date:- ${BUILD_DATE}"
|
||||
LABEL maintainer="${BUILD_MAINTAINER}"
|
||||
|
||||
LABEL maintainer="${MAINTAINER}"
|
||||
LABEL org.opencontainers.image.title="${APP_NAME}"
|
||||
# RHEL nutzt microdnf. Wir installieren xz (für tar) und shadow-utils (für useradd)
|
||||
RUN microdnf update -y && \
|
||||
microdnf install -y --nodocs \
|
||||
xz \
|
||||
tar \
|
||||
shadow-utils \
|
||||
tzdata && \
|
||||
microdnf clean all
|
||||
|
||||
ENV TZ=${TZ}
|
||||
ENV USER=${APP_USER}
|
||||
# add s6 overlay
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-${BUILD_S6_ARCH_amd64}.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-${BUILD_S6_ARCH_amd64}.tar.xz
|
||||
|
||||
RUN apk add --no-cache tzdata ca-certificates
|
||||
# add s6 optional symlinks
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz && unlink /usr/bin/with-contenv
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${BUILD_S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
|
||||
|
||||
WORKDIR /app
|
||||
COPY ./config /app/config
|
||||
COPY ./data /app/data
|
||||
# LSIO Mods Integration
|
||||
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/docker-mods.${MODS_VERSION}" "/docker-mods"
|
||||
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run"
|
||||
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" "/usr/bin/lsiown"
|
||||
ADD --chmod=755 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/with-contenv.${WITHCONTENV_VERSION}" "/usr/bin/with-contenv"
|
||||
|
||||
RUN adduser -D ${APP_USER} && chown -R ${APP_USER}:${APP_USER} /app
|
||||
# set environment variables
|
||||
ENV HOME="/root" \
|
||||
LANGUAGE="de_DE.UTF-8" \
|
||||
LANG="de_DE.UTF-8" \
|
||||
TERM="xterm" \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0" \
|
||||
S6_VERBOSITY=1 \
|
||||
S6_STAGE2_HOOK=/docker-mods \
|
||||
VIRTUAL_ENV=/lsiopy \
|
||||
PATH="/lsiopy/bin:$PATH"
|
||||
|
||||
USER ${APP_USER}
|
||||
RUN echo "**** install packages and locales ****" && \
|
||||
microdnf install -y --nodocs \
|
||||
glibc-langpack-de \
|
||||
curl \
|
||||
jq \
|
||||
nmap-ncat \
|
||||
cronie && \
|
||||
echo "**** create user and folders ****" && \
|
||||
# In RHEL prüfen wir, ob die Gruppe existiert, bevor wir sie anlegen
|
||||
groupadd -g ${BUILD_APP_GID} ${BUILD_APP_USER} || true && \
|
||||
useradd -u ${BUILD_APP_UID} -g ${BUILD_APP_GID} -d /config -s /bin/false ${BUILD_APP_USER} && \
|
||||
mkdir -p /app /config /defaults /lsiopy && \
|
||||
echo "**** cleanup ****" && \
|
||||
microdnf clean all && \
|
||||
rm -rf /tmp/* /var/tmp/*
|
||||
|
||||
CMD ["sh"]
|
||||
# 7. Lokale Skripte kopieren und Ausführungsrechte für S6 reparieren
|
||||
ADD https://git.pi-farm.de/pi-farm/s6-overlay/archive/stable.tar.gz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/stable.tar.gz && rm -rf /tmp/stable.tar.gz
|
||||
RUN find /etc/s6-overlay/s6-rc.d/ -type f \( -name "run" -o -name "up" \) -exec chmod +x {} +
|
||||
|
||||
ENTRYPOINT ["/init"]
|
||||
Reference in New Issue
Block a user