Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jparra-amell/api_solsql/llms.txt

Use this file to discover all available pages before exploring further.

SolSQL API ships with a multi-stage Dockerfile that produces a lean ASP.NET Core 8 runtime image. This guide covers building the image, setting the MySQL connection string, and starting the container — either directly with Docker or through Docker Compose.
The appsettings.json file in the repository contains a real MySQL connection string with credentials. Do not commit or distribute this file in production environments. Use environment variables or a secrets manager to inject the connection string at runtime.
1

Review the Dockerfile

The project uses a two-stage build. The first stage compiles the application with the .NET 8 SDK; the second stage produces a minimal runtime image and exposes port 8080.
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src

# Como el .csproj está junto al Dockerfile, copiamos directo
COPY ["api_solsql/api_solsql.csproj", "./"]
RUN dotnet restore "api_solsql.csproj"

# Copiamos todo el proyecto
COPY . .
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false

# Imagen final
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app
COPY --from=build /app/publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "api_solsql.dll"]
2

Configure the MySQL connection string

The API reads the database connection from the Connection_mysql key in appsettings.json:
{
  "ConnectionStrings": {
    "Connection_mysql": "Server=<host>; Database=<db>; user=<user>; password=<password>; port=<port>;"
  }
}
Replace the placeholder values with your MySQL server details before building, or override the value at runtime using an environment variable:
ConnectionStrings__Connection_mysql="Server=myhost; Database=mydb; user=myuser; password=mypassword; port=3306;"
ASP.NET Core maps the double-underscore (__) separator in environment variable names to nested JSON keys, so ConnectionStrings__Connection_mysql overrides ConnectionStrings.Connection_mysql without modifying any file.
3

Build the Docker image

Run the following command from the repository root (the directory that contains the api_solsql/ folder and docker-compose.yml):
docker build -f api_solsql/Dockerfile -t apisolsql .
The build restores NuGet packages, compiles the project in Release mode, and copies the published output into the final runtime image.
4

Run the container

Start the container and map port 8080 to your host:
docker run -p 8080:8080 \
  -e "ConnectionStrings__Connection_mysql=Server=myhost; Database=mydb; user=myuser; password=mypassword; port=3306;" \
  apisolsql
The API will be available at http://localhost:8080. Open http://localhost:8080/swagger to verify the service is running.
5

Use Docker Compose (optional)

The repository includes a docker-compose.yml for convenience:
services:
  api_solsql:
    image: ${DOCKER_REGISTRY-}apisolsql
    build:
      context: .
      dockerfile: api_solsql/Dockerfile
You can extend this file to add environment variables, port mappings, and a MySQL service. To build and start with Compose:
docker compose up --build
To pass the connection string without modifying the Compose file, set it in a .env file or export it in your shell before running docker compose up.
Create a .env file in the repository root and add ConnectionStrings__Connection_mysql=... to keep your credentials out of shell history and version control. Add .env to .gitignore.

Next steps

Quickstart

Make your first API call and verify authentication is working.

Authentication

Understand the login flow and how roles map to user types.

Build docs developers (and LLMs) love