monero-node-container/Containerfile
2023-10-19 23:16:10 -04:00

75 lines
2.3 KiB
Docker

# Copyright 2023 Foster Hangdaan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG MONERO_VERSION=v0.18.3.1
ARG PACKAGE_HASH=23af572fdfe3459b9ab97e2e9aa7e3c11021c955d6064b801a27d7e8c21ae09d
ARG PACKAGE_NAME=monero-linux-x64-${MONERO_VERSION}.tar.bz2
# download and unpack stage
FROM docker.io/library/debian:12-slim as downloader
RUN set -ex && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends --yes install \
ca-certificates \
wget
WORKDIR /monero
ARG MONERO_VERSION
ARG PACKAGE_HASH
ARG PACKAGE_NAME
RUN set -ex && \
wget --quiet https://downloads.getmonero.org/cli/${PACKAGE_NAME} && \
echo "${PACKAGE_HASH} ${PACKAGE_NAME}" | sha256sum --check && \
mkdir ./tmp && \
tar -xjf ${PACKAGE_NAME} -C ./tmp --strip-components 1
# runtime stage
FROM docker.io/library/debian:12-slim
LABEL maintainer="Foster Hangdaan <foster@hangdaan.email>"
RUN set -ex && \
apt-get update && \
apt-get --no-install-recommends --yes install ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt
COPY --from=downloader /monero/tmp/monerod /monero/tmp/monero-wallet* /usr/local/bin/
# Create monero user
RUN adduser --system --group --disabled-password monero && \
mkdir -p /wallet /home/monero/.bitmonero && \
chown -R monero:monero /home/monero/.bitmonero && \
chown -R monero:monero /wallet
# Contains the blockchain
VOLUME /home/monero/.bitmonero
# Generate your wallet via accessing the container and run:
# cd /wallet
# monero-wallet-cli
VOLUME /wallet
EXPOSE 18080
EXPOSE 18081
EXPOSE 18089
# switch to user monero
USER monero
ENTRYPOINT ["monerod"]
CMD ["--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=18080", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=18081", "--rpc-restricted-bind-ip=0.0.0.0", "--rpc-restricted-bind-port=18089", "--non-interactive", "--confirm-external-bind"]