monero-node-container/Containerfile

77 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.3
ARG PACKAGE_HASH=47c7e6b4b88a57205800a2538065a7874174cd087eedc2526bee1ebcce0cc5e3
ARG PACKAGE_NAME=monero-linux-x64-${MONERO_VERSION}.tar.bz2
# download and unpack stage
FROM docker.io/library/ubuntu:22.04 as downloader
RUN set -ex && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends --yes install \
bzip2 \
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/ubuntu:22.04
LABEL maintainer="Foster Hangdaan <foster@hangdaan.email>"
RUN set -ex && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive 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"]