diff --git a/Dockerfile b/Dockerfile index b4f6153..400d6ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ RUN apt-get update && \ EXPOSE 27017 8080 ADD target/url-shortener-images.jar url-shortener-images.jar -RUN apt-get update && apt-get install -y supervisor -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf -CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] \ No newline at end of file + +COPY start.sh /start.sh +RUN chmod +x /start.sh +CMD ["/start.sh"] \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..1ec330d --- /dev/null +++ b/start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Start MongoDB +mongod --fork --logpath /var/log/mongodb/mongod.log + +# Wait for MongoDB to start (adjust the sleep duration as needed) +sleep 5 + +# Start your Java application +java -jar /url-shortener-images.jar