Table of Contents

Usage in Docker and AWS

This page explains how to run List & Label Cross Platform within a Docker container and deploy your containerized application to AWS using Amazon Elastic Container Service (ECS) with Fargate.


Running in Docker

List & Label Cross Platform is fully compatible with Docker. When using a downstripped Linux image, you may need to install extra libraries. Here's an example Dockerfile snippet:

# This stage is used when running from Visual Studio in fast mode (Default for Debug configuration)
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app

USER root
RUN apt-get update && apt-get install -y libc6 libfontconfig1 libfreetype6 libpng16-16 libjpeg62-turbo libgif7 && apt-get clean
USER $APP_UID

Depending on your target OS, you also need to install additional NuGet packages for Skia, e. g. SkiaSharp.NativeAssets.Linux on Linux.

Tip

Make sure to embed all fonts in your project file when deploying to Docker. By default, the image won't have any fonts installed, so embedding them ensures everything looks as expected.

Notes:

  • The base image mcr.microsoft.com/dotnet/aspnet:9.0 is a stripped-down Linux image.
  • The apt-get install command installs essential libraries required for rendering and processing fonts and images.
  • Adjust package names or versions as necessary based on your Linux distribution or specific application needs.

Deploying to AWS ECS and Fargate

AWS offers several services for running containerized applications. The recommended approach is to use Amazon ECS with Fargate, which allows you to run containers without managing the underlying infrastructure.

Steps to deploy

  1. Build your Docker image:
    Build the image locally or within your CI/CD pipeline using your Dockerfile:

    docker build -t mylistlabelapp .
    
  2. Push the image to Amazon ECR:
    Create an Amazon ECR repository and push your image there. Use the following commands (replace <aws_account_id> and <region> with your actual values):

    aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
    docker tag mylistlabelapp:latest <aws_account_id>.dkr.ecr.<region>.amazonaws.com/mylistlabelapp:latest
    docker push <aws_account_id>.dkr.ecr.<region>.amazonaws.com/mylistlabelapp:latest
    
  3. Create an ECS cluster:
    In the AWS Management Console, create a new ECS cluster configured for Fargate. This provides the orchestration needed to run your containerized application.

  4. Define a task definition:
    Create a task definition that specifies:

    • The container image (from your ECR repository)
    • Port mappings
    • Environment variables and any necessary runtime settings
  5. Deploy a service:
    Using your task definition, create an ECS service that runs your container on Fargate. Configure options such as:

    • Desired task count
    • Auto-scaling policies
    • Load balancing (if needed)
  6. Monitor and manage:
    Use AWS CloudWatch to monitor logs, metrics, and application performance. This helps you ensure that your application runs smoothly in production.


Additional resources


By following these steps, you can successfully containerize your List & Label Cross Platform application and deploy it on AWS ECS with Fargate. This setup ensures that your application benefits from AWS's scalable infrastructure and integrated monitoring tools.