udp Dockerfile: use here-doc for entrypoint creation

This commit is contained in:
Joakim Frostegård 2022-07-24 11:47:31 +02:00
parent 2a39198692
commit bd70474d73

View file

@ -1,8 +1,13 @@
# syntax=docker/dockerfile:1
# aquatic_udp
#
# Customize by setting CONFIG_FILE_CONTENTS and
# ACCESS_LIST_CONTENTS environment variables.
#
# By default runs tracker on port 3000 without info hash access control.
#
# Run from repository root directory with:
# $ docker build -t aquatic-udp -f docker/aquatic_udp.Dockerfile .
# $ docker run -it -p 0.0.0.0:3000:3000/udp --name aquatic-udp aquatic-udp
@ -23,7 +28,15 @@ WORKDIR /root/
COPY --from=builder /usr/src/aquatic/target/release/aquatic_udp ./
# Setting config and access list file contents at runtime
RUN echo "#!/bin/sh\necho \"\$CONFIG_FILE_CONTENTS\" > ./config.toml\necho \"\$ACCESS_LIST_CONTENTS\" > ./access-list.txt\n./aquatic_udp -c ./config.toml" > entrypoint.sh && chmod +x entrypoint.sh
# Create entry point script for setting config and access
# list file contents at runtime
COPY <<-"EOT" ./entrypoint.sh
#!/bin/sh
echo "$CONFIG_FILE_CONTENTS" > ./config.toml
echo "$ACCESS_LIST_CONTENTS" > ./access-list.txt
exec ./aquatic_udp -P -c ./config.toml
EOT
RUN chmod +x ./entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]