Last active
October 7, 2024 02:06
-
-
Save jbmarflo/3c7fe6b8406ee79d8db118d9a0d77bab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Utiliza la imagen base de Node.js en Ubuntu para plataforma AMD64 | |
FROM --platform=linux/amd64 node:lts | |
# Define variables de entorno | |
ARG LAMBDA_TASK_ROOT="/app" | |
ARG LAMBDA_RUNTIME_DIR="/usr/local/bin" | |
ARG PLATFORM="linux/amd64" | |
# Establece el directorio de trabajo | |
WORKDIR ${LAMBDA_TASK_ROOT} | |
# Actualiza los repositorios e instala las dependencias necesarias | |
RUN apt-get update && \ | |
apt-get install -y \ | |
ghostscript \ | |
dvisvgm \ | |
g++ \ | |
make \ | |
cmake \ | |
unzip \ | |
libcurl4-openssl-dev \ | |
autoconf \ | |
automake \ | |
build-essential \ | |
libtool \ | |
m4 \ | |
python3 \ | |
libssl-dev && \ | |
rm -rf /var/lib/apt/lists/* | |
# Instala el AWS Lambda Runtime Interface Client globalmente | |
RUN npm install -g aws-lambda-ric | |
# Copia el código de la función Lambda al contenedor | |
COPY ./ ${LAMBDA_TASK_ROOT}/ | |
# Instala las dependencias de Node.js | |
RUN npm install | |
# Crear directorio para evitar advertencias de npm | |
RUN mkdir -p /tmp/.npm/_logs | |
ENV npm_config_cache=/tmp/.npm | |
# Añade el Runtime Interface Emulator para pruebas locales (opcional) | |
ADD "https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie" "/usr/bin/aws-lambda-rie" | |
# Copia el script de entrada | |
COPY entry.sh / | |
# Da permisos de ejecución al Runtime Interface Emulator y al script de entrada | |
RUN chmod 755 /usr/bin/aws-lambda-rie /entry.sh | |
# Establece el directorio de trabajo nuevamente | |
WORKDIR ${LAMBDA_TASK_ROOT} | |
# Define el punto de entrada y el comando por defecto | |
ENTRYPOINT ["/entry.sh"] | |
CMD ["dist/infrastructure/server.handler"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment