NomadNet/Dockerfile
JP Hastings-Spital 3fc321e804
Move --daemon to CMD from ENTRYPOINT
I've moved the `--daemon` command from `ENTRYPOINT` to `CMD` to allow users of the dockerfile some flexibility 

The executable and/or arguments in `CMD` can be overridden easily by users of the container, but `ENTRYPOINT` is intended as a "this is always at the start of the command". ([reference](https://docs.docker.com/engine/reference/builder/#cmd))

For example, with the change in this commit:
- `docker run ghcr.io/markqvist/nomadnet:master --help` will output the same as `nomadnet --help`
- `docker run ghcr.io/markqvist/nomadnet:master` will run `nomadnet --daemon`
- `docker run ghcr.io/markqvist/nomadnet:master ""` will run `nomadnet` (if we wanted this to be a little more self-explaining, there could be a `--ui` flag which runs the UI and is default-on, so `docker run ghcr.io/markqvist/nomadnet:master --ui` would work)
2022-05-18 08:56:45 +01:00

26 lines
732 B
Docker

FROM python:3.11-rc-alpine3.14 as build
RUN apk add --no-cache build-base linux-headers libffi-dev cargo
# Create a virtualenv that we'll copy to the published image
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install setuptools-rust pyopenssl cryptography
COPY . /app/
RUN cd /app/ && python3 setup.py install
# Use multi-stage build, as we don't need rust compilation on the final image
FROM python:3.11-rc-alpine3.14
LABEL org.opencontainers.image.documentation="https://github.com/markqvist/NomadNet#nomad-network-daemon-with-docker"
ENV PATH="/opt/venv/bin:$PATH"
COPY --from=build /opt/venv /opt/venv
VOLUME /root/.reticulum
VOLUME /root/.nomadnetwork
ENTRYPOINT ["nomadnet"]
CMD ["--daemon"]