fix install on new host
This commit is contained in:
@@ -8,3 +8,38 @@ RUN chmod +rx /container-init.d/*.sh
|
||||
|
||||
FROM dist as master
|
||||
ARG DOCKER_BUILD_DIR
|
||||
ARG UID
|
||||
ENV UID=${UID}
|
||||
ENV USER=ipfs
|
||||
|
||||
# If we provide a numeric UID
|
||||
RUN if [ "${UID}" -eq "${UID}" ] 2>/dev/null; then \
|
||||
# Force $UID of $USER if it exists
|
||||
if [ "$(awk -F: '$1 == "'"${USER}"'" {print $3}' /etc/passwd)" != "${UID}" ]; then \
|
||||
sed -i 's/^\('"${USER}"':x\):[0-9]\+:/\1:'"${UID}"':/' /etc/passwd; \
|
||||
fi; \
|
||||
# Create $USER if $UID does not exist
|
||||
if [ "$(awk -F: '$3 == "'"${UID}"'" {print $1}' /etc/passwd)" = "" ]; then \
|
||||
echo "${USER}:x:${UID}:${GID:-${UID}}::/home/${USER}:${SHELL:-/bin/sh}" >> /etc/passwd; \
|
||||
echo "${USER}:\!:$(($(date +%s) / 60 / 60 / 24)):0:99999:7:::" >> /etc/shadow; \
|
||||
mkdir -p /home/"${USER}"; \
|
||||
fi; \
|
||||
chown "${UID}" $(awk -F: '$1 == "'"${USER}"'" {print $(NF-1)}' /etc/passwd); \
|
||||
fi
|
||||
|
||||
# If we provide a numeric GID
|
||||
RUN if [ "${GID}" -eq "${GID}" ] 2>/dev/null; then \
|
||||
# Force $GID of $GROUP if it already exists
|
||||
if [ "$(awk -F: '$1 == "'"${GROUP}"'" {print $3}' /etc/group)" != "${GID}" ]; then \
|
||||
sed -i 's/^\('"${GROUP}"':x\):[0-9]\+:/\1:'"${GID}"':/' /etc/group; \
|
||||
fi; \
|
||||
# Create $GROUP if $GID does not exist
|
||||
if [ "$(awk -F: '$3 == "'"${GID}"'" {print $1}' /etc/group)" = "" ]; then \
|
||||
echo "${GROUP}:x:${GID}:" >> /etc/group; \
|
||||
fi; \
|
||||
# Force $GID of $USER if it exists
|
||||
if [ "$(awk -F: '$1 == "'"${USER}"'" {print $4}' /etc/passwd)" != "${GID}" ]; then \
|
||||
sed -i 's/^\('"${USER}"':x:[0-9]\+\):[0-9]\+:/\1:'"${GID}"':/' /etc/passwd; \
|
||||
fi; \
|
||||
chgrp "${GID}" $(awk -F: '$1 == "'"${USER}"'" {print $(NF-1)}' /etc/passwd); \
|
||||
fi
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
## fix resource manager fatal error on arm64/linux with 2Gb RAM
|
||||
# ipfs config --json Swarm.ResourceMgr.Enabled false
|
||||
@@ -15,7 +16,17 @@ ipfs config Pubsub.Router gossipsub
|
||||
ipfs config --json Experimental.Libp2pStreamMounting true
|
||||
ipfs config --json Experimental.P2pHttpProxy true
|
||||
ipfs config Addresses.Gateway "/ip4/0.0.0.0/tcp/8080"
|
||||
ipfs config Addresses.Api "/ip4/0.0.0.0/tcp/5001"
|
||||
|
||||
## ipfs client needs API address
|
||||
# search for ip address of $(hostname).${IPFS_ADDRESSES_API_DOMAIN}
|
||||
[ -n "${IPFS_ADDRESSES_API_DOMAIN}" ] && [ -z "${IPFS_ADDRESSES_API_INET4}" ] \
|
||||
&& IPFS_ADDRESSES_API_INET4=$(nslookup -type=A "$(hostname).${IPFS_ADDRESSES_API_DOMAIN}" |awk 'found && /^Address:/ {print $2; found=0}; /^Name:\t'"$(hostname).${IPFS_ADDRESSES_API_DOMAIN}"'/ {found=1};')
|
||||
# check ${IPFS_ADDRESSES_API_INET4} format
|
||||
echo "${IPFS_ADDRESSES_API_INET4}" |awk -F. '{ for ( i=1; i<=4; i++ ) if ($i >= 0 && $i <= 255); else exit 1;}; NF != 4 {exit 1;}' || unset IPFS_ADDRESSES_API_INET4
|
||||
# check ${IPFS_ADDRESSES_API_PORT} format
|
||||
[ "${IPFS_ADDRESSES_API_PORT}" -eq "${IPFS_ADDRESSES_API_PORT}" ] 2>/dev/null && [ "${IPFS_ADDRESSES_API_PORT}" -ge 1 ] && [ "${IPFS_ADDRESSES_API_PORT}" -le 65535 ] \
|
||||
|| unset IPFS_ADDRESSES_API_PORT
|
||||
ipfs config Addresses.Api "${IPFS_ADDRESSES_API:-/ip4/${IPFS_ADDRESSES_API_INET4:-127.0.0.1}/tcp/${IPFS_ADDRESSES_API_PORT:-5001}}"
|
||||
|
||||
## REMOVE IPFS BOOTSTRAP
|
||||
ipfs bootstrap rm --all
|
||||
|
||||
+6
-11
@@ -26,6 +26,7 @@ RUN apt-get update \
|
||||
screen \
|
||||
socat \
|
||||
tmux \
|
||||
vim-nox \
|
||||
wget \
|
||||
xz-utils
|
||||
|
||||
@@ -43,9 +44,6 @@ RUN { OS="$(echo ${OPERATING_SYSTEM} |awk '{print tolower($0)}')"; \
|
||||
|tar --strip-components 1 -C /usr/local/lib/shellspec -xzf - \
|
||||
&& ln -s /usr/local/lib/shellspec/shellspec /usr/local/bin/shellspec
|
||||
|
||||
ADD https://raw.github.com/aya/dpgpid/master/keygen /usr/local/bin/keygen
|
||||
RUN chmod +rx /usr/local/bin/keygen
|
||||
|
||||
ADD https://raw.github.com/kvz/cronlock/master/cronlock /usr/local/bin/cronlock
|
||||
RUN chmod +rx /usr/local/bin/cronlock
|
||||
|
||||
@@ -54,9 +52,9 @@ ADD https://git.p2p.legal/axiom-team/astrXbian/raw/branch/master/install.sh /
|
||||
RUN chmod +r /include.sh \
|
||||
&& chmod +rx /install.sh
|
||||
|
||||
# COPY ${DOCKER_BUILD_DIR}/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
# ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
# CMD ["/bin/sh"]
|
||||
COPY ${DOCKER_BUILD_DIR}/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["start"]
|
||||
|
||||
FROM dist as master
|
||||
ARG DOCKER_BUILD_DIR
|
||||
@@ -70,7 +68,6 @@ ENV USER=${USER}
|
||||
|
||||
RUN apt-get -fy install \
|
||||
cron \
|
||||
pkg-config \
|
||||
python3 \
|
||||
sudo
|
||||
|
||||
@@ -109,6 +106,8 @@ USER $USER
|
||||
ENV SHELL=${SHELL}
|
||||
WORKDIR /home/$USER
|
||||
|
||||
RUN mkdir ~/.zen ~/astroport
|
||||
|
||||
# git config
|
||||
RUN mkdir -p ~/.config/git \
|
||||
&& echo -e "\
|
||||
@@ -122,7 +121,3 @@ Thumbs.db\n\
|
||||
" > ~/.config/git/ignore
|
||||
|
||||
RUN bash -c '. /include.sh && install_requirements'
|
||||
|
||||
COPY ${DOCKER_BUILD_DIR}/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["start"]
|
||||
|
||||
@@ -11,7 +11,7 @@ debug_msg ()
|
||||
}
|
||||
|
||||
# Install astrXbian/Astroport.ONE
|
||||
# /install.sh
|
||||
/install.sh
|
||||
|
||||
case "${1:-start}" in
|
||||
|
||||
|
||||
Reference in New Issue
Block a user