# base image (AWS Lambda)
FROM public.ecr.aws/lambda/dotnet:5.0

RUN yum update -y && yum install -y gcc-c++ glibc-devel.i686 glibc.i686 pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 dbus-glib-devel && yum install -y libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64  && yum install -y libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 ipa-gothic-fonts xorg-x11-fonts-100dpi && yum install -y xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc && yum install -y glibc-devel.x86_64 at-spi2-atk.x86_64 mesa-libgbm.x86_64 libxshmfence libxkbcommon amazon-linux-extras && amazon-linux-extras install epel -y && yum install -y libgdiplus && yum clean all && rm -rf /var/cache/yum

# This COPY command copies the .NET Lambda project's build artifacts from the host machine into the image. 
# The source of the COPY should match where the .NET Lambda project publishes its build artifacts. If the Lambda function is being built 
# with the AWS .NET Lambda Tooling, the `--docker-host-build-output-dir` switch controls where the .NET Lambda project
# will be built. The .NET Lambda project templates default to having `--docker-host-build-output-dir`
# set in the aws-lambda-tools-defaults.json file to "bin/Release/lambda-publish".
#
# Alternatively Docker multi-stage build could be used to build the .NET Lambda project inside the image.
# For more information on this approach checkout the project's README.md file.
WORKDIR /var/task
COPY "bin/Release/lambda-publish"  .
CMD ["AWSLambdaNet5Container::AWSLambdaNet5Container.PrintPdf::FunctionHandler"]