Docker image packaging of a simple Spring Boot web app to list values from PostgreSQL DB. Created for an optional Docker course project.
- Clone the project and navigate to it:
git clone https://github.com/g-otn/soat-docker-challenge.git cd soat-docker-challenge- Make sure port
80is not in use. - Run Docker Compose:
docker compose up # or docker-compose up- Wait for the Spring Boot app to startup.
- Access
http://localhost/programming-languagesand you should see a JSON array listing some programming languages, retrieved from the db container.
To build the backend image:
- Open and configure the
backend/project with your Java IDE. - Compile and package it using Maven.
- Build the
Dockerfile.- e.g:
docker buildx build -t g0tn/soat-docker-challenge-backend backend - Build arguments:
arg description default JAR_FILEPath to packaged .jar file target/dockerchallenge-0.0.1.jar - Environment variables:
env var description default APP_USERInternal user for running the app backendAPP_FOLDERWorking directory where the jar will be copied to /opt/app
- e.g:
- Prof. Luiz Zenha and Prof. Matheus Pavani: Course teachers.
- marcelovbcfilho: Help with Docker Compose.