Spring-Boot- UberApp Backend Simulation
204
UberApp Docker Repository
This repository contains the Docker image for the UberApp, a Spring Boot application. Follow the instructions below to create a Dockerfile and run the image on your system.
Docker Image Details Repository: ujjwal4maletha/uberapp
Tag: 0.0.1-snapshot
Base Image: openjdk:11-jre-slim
How to Create a Dockerfile To create a Dockerfile for the UberApp, follow these steps:
Create a File Named Dockerfile: touch Dockerfile Add the Following Content to the Dockerfile:
Dockerfile FROM openjdk:11-jre-slim VOLUME /tmp COPY target/uberApp-0.0.1-SNAPSHOT.jar app.jar EXPOSE 8080 ENV JWT_SECRET_KEY=your-secret-key ENV DB_URL=jdbc:mysql://localhost:3306/yourdatabase ENV DB_USERNAME=yourusername ENV DB_PASSWORD=yourpassword ENTRYPOINT ["java", "-jar", "app.jar"]
Replace the placeholder values (your-secret-key, jdbc:mysql://localhost:3306/yourdatabase, yourusername, yourpassword) with the actual values.
Building the Docker Image To build the Docker image, navigate to the directory containing your Dockerfile and run the following command:
bash docker build -t ujjwal4maletha/uberapp:0.0.1-snapshot . Running the Docker Image
To run the Docker image, use the following command:
docker run -p 8080:8080 ujjwal4maletha/uberapp:0.0.1-snapshot
Setting Environment Variables If you need to pass different environment variables, you can modify the docker run command like this:
docker run -e JWT_SECRET_KEY=new-secret-key -e DB_URL=jdbc:mysql://newhost:3306/newdatabase -e DB_USERNAME=newusername -e DB_PASSWORD=newpassword -p 8080:8080 ujjwal4maletha/uberapp:0.0.1-snapshot
Pushing the Docker Image to Docker Hub After building and testing your Docker image, you can push it to Docker Hub. Ensure you're logged in to Docker Hub using the following command:
docker login Then, tag your image and push it:
docker tag ujjwal4maletha/uberapp:0.0.1-snapshot {your tag} docker push ujjwal4maletha/uberapp:0.0.1-snapshot
Content type
Image
Digest
sha256:28d2fa9ec…
Size
299.2 MB
Last updated
almost 2 years ago
docker pull ujjwal4maletha/uberapp:v2.2