FROM ubuntu:latest

# Install dependencies
RUN apt-get update && apt-get install -y \
   curl \
   libicu-dev \
   libssl-dev \
   git

# Install Node.js 18.x
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
   && apt-get install -y nodejs

# Install Yarn
RUN npm install -g yarn

# Install .NET Core 3.x
# RUN curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --version 3.1.426
RUN curl -fsSL https://dot.net/v1/dotnet-install.sh | bash -s -- --version 9.0.101a

# Set environment variables
ENV DOTNET_ROOT=/root/.dotnet
ENV PATH=$PATH:/root/.dotnet
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
RUN mkdir -p /app
COPY . /app
RUN "yarn install --frozen-lockfile
WORKDIR /app

# Test command
CMD ["sh", "-c", "npx projen compile && npx projen package:dotnet"]