Sign inSign up

rafaelqsantosrqs/opencontact-api

By rafaelqsantosrqs

•Updated about 1 year ago

This is the official Docker image for the OpenContact API.

Image
Languages & frameworks
Web servers
0

377

rafaelqsantosrqs/opencontact-api repository overview

⁠OpenContact API

This is the official Docker image for the OpenContact API, a backend service for managing contacts and schedules.

⁠How to Run this Image

The quickest way to run the OpenContact API is via the docker run command. You must provide the necessary environment variables for the database connection.

⁠1. Start a Database

This image requires a running PostgreSQL database. You can start one easily with Docker:

docker run -d --name opencontact-db \
  -e POSTGRES_DB=opencontact \
  -e POSTGRES_USER=user \
  -e POSTGRES_PASSWORD=password \
  --network opencontact-net \
  postgres:15-alpine
⁠2. Run the Application Image

Now, run the OpenContact API image, connecting it to the database network and providing the correct credentials.

docker run -d --name opencontact-api \
  -p 8080:8080 \
  --network opencontact-net \
  -e SPRING_DATASOURCE_URL=jdbc:postgresql://opencontact-db:5432/opencontact \
  -e SPRING_DATASOURCE_USERNAME=user \
  -e SPRING_DATASOURCE_PASSWORD=password \
  rafaelqsantosrqs/opencontact-api:latest

The API will then be available at http://localhost:8080.


⁠Configuration

The application is configured via the following environment variables:

VariableDescriptionExample Value
SPRING_DATASOURCE_URLPostgreSQL connection URLjdbc:postgresql://db:5432/my_database
SPRING_DATASOURCE_USERNAMEDatabase usernameapp_user
SPRING_DATASOURCE_PASSWORDDatabase passwordsupersecret123
JPA_DDL_AUTOHibernate schema management strategyvalidate
JPA_SHOW_SQLWhether to log executed SQL queriestrue
JPA_FORMAT_SQLWhether to pretty-print SQL queriestrue
SPRING_LIQUIBASE_CONTEXTSLiquibase context used to run seeds/migrationsdev

⁠Development with Docker Compose

For local development or to run a complete stack with a single command, you can use the docker-compose.yaml file from the source repository⁠.

  1. Clone the repository.
  2. Create an .env file from the .env.template.
  3. Run docker-compose up.

⁠Image Architecture

This image is built using a multi-stage Dockerfile for optimization and security.

  • The build stage uses a full Maven and JDK environment.
  • The final image uses a minimal openjdk:17-slim base and copies only the final application .jar.
  • The application is executed by a dedicated, non-root user (springuser) to enhance security.

Tag summary

Content type

Image

Digest

sha256:fa3bfd901…

Size

126.2 MB

Last updated

about 1 year ago

docker pull rafaelqsantosrqs/opencontact-api