Update docker to be better

This commit is contained in:
Ethan O'Brien 2024-07-04 16:21:03 -05:00
parent 18c5524ce2
commit fbda01a5fe
3 changed files with 13 additions and 2 deletions

View file

@ -15,7 +15,7 @@ WORKDIR /ew/
RUN . "$HOME/.cargo/env" && cargo build --release RUN . "$HOME/.cargo/env" && cargo build --release
RUN mkdir /root/ew/ && cp target/release/ew /root/ew/ew RUN mkdir /root/ew/ && cp target/release/ew /root/ew/ew
RUN echo "#!/bin/bash\n\n /root/ew/ew --path \"\${DIRECTORY:-/data/}\" --port \"\${PORT:-8080}\"" > /root/ew/start.sh COPY ./start.sh /root/ew/start.sh
RUN chmod +x /root/ew/start.sh RUN chmod +x /root/ew/start.sh

View file

@ -7,7 +7,8 @@ services:
dockerfile: "./Dockerfile" dockerfile: "./Dockerfile"
environment: environment:
PORT: 8081 PORT: 8081
DIRECTORY: /data DIRECTORY: /data/
HTTPS: false
ports: ports:
- 8081:8081 - 8081:8081
volumes: volumes:

10
docker/start.sh Normal file
View file

@ -0,0 +1,10 @@
#!/bin/bash
port="${PORT:-8080}"
directory="${DIRECTORY:-/data/}"
if [ "$HTTPS" = "true" ]; then
/root/ew/ew --path $directory --port $port --https
else
/root/ew/ew --path $directory --port $port
fi