diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e160010 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,40 @@ +# Git +.git +.gitignore + +# Build outputs +**/bin/ +**/obj/ +**/out/ + +# Test results +TestResults/ +*.trx +*.coverage + +# IDE files +.vs/ +.vscode/ +*.user +*.suo + +# OS generated files +.DS_Store +Thumbs.db + +# Temporary files +*.tmp +*.temp + +# Documentation (not needed in container) +docs/ +README.md +*.md + +# Local data directories +data/ +*.db +*.sqlite + +# Logs +*.log \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1096f44..1d2f241 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +Parsing/TSqlLexer.interp +Parsing/TSqlLexer.tokens +Parsing/TSqlParser.interp +Parsing/TSqlParser.tokens ## due to takekazuomi: https://gist.github.com/takekazuomi/10955889 @@ -142,4 +146,10 @@ _NCrunch* # Visual Studio temp something .vs/ -Parsing/.antlr \ No newline at end of file +Parsing/.antlr + +# Auto-generated Antlr4 C# files +Parsing/TSqlLexer.cs +Parsing/TSqlParser.cs +Parsing/TSqlParserBaseListener.cs +Parsing/TSqlParserListener.cs diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..30a85bb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,55 @@ +# Dockerfile with automatic ANTLR code generation via Antlr4BuildTasks + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build + +# Install Java for Antlr4BuildTasks +RUN apt-get update && apt-get install -y openjdk-17-jre-headless && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# Copy solution and project files +COPY *.sln ./ +COPY JankSQL/*.csproj JankSQL/ +COPY Parsing/*.csproj Parsing/ +COPY Tests/*.csproj Tests/ +COPY JankSh/*.csproj JankSh/ +COPY ScratchWork/*.csproj ScratchWork/ + +# Restore dependencies +RUN dotnet restore JankSQL.sln + +# Copy the rest of the source code +COPY . . + +# Build the solution (CSharpTest.Net.Collections now comes from NuGet) +RUN dotnet build JankSQL.sln -c Release --no-restore + +# Run tests (optional - comment out if you want faster builds) +# RUN dotnet test Tests/Tests.csproj -c Release --no-build --verbosity minimal + +# Create runtime image +FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime + +WORKDIR /app + +# Copy built applications from build stage +COPY --from=build /app/JankSQL/bin/Release/net8.0 ./JankSQL +COPY --from=build /app/JankSh/bin/Release/net8.0 ./JankSh + +# Create directories for data persistence +RUN mkdir -p /data/btree + +# Set environment variables +ENV DOTNET_ENVIRONMENT=Production + +# Default to running the interactive shell +# Users can override this to run other components +ENTRYPOINT ["dotnet", "JankSh/JankSh.dll"] + +# Expose any ports if needed (none specified in current implementation) +# EXPOSE 5432 + +# Add labels for metadata +LABEL maintainer="JankSQL Project" +LABEL description="JankSQL - A simple SQL database server implementation in C#" +LABEL version="1.0" diff --git a/JankSQL/JankSQL.csproj b/JankSQL/JankSQL.csproj index 56efe53..66d87f8 100644 --- a/JankSQL/JankSQL.csproj +++ b/JankSQL/JankSQL.csproj @@ -30,9 +30,7 @@ - - ..\..\CSharpTest.Net.Collections\src\CSharpTest.Net.Collections\bin\net6.0\CSharpTest.Net.Collections.dll - + diff --git a/Parsing/Parsing.csproj b/Parsing/Parsing.csproj index 5517128..40e2fb7 100644 --- a/Parsing/Parsing.csproj +++ b/Parsing/Parsing.csproj @@ -10,26 +10,18 @@ - - + + - C:\antlr\antlr-4.12.0-complete.jar - C:\Program Files\Common Files\Oracle\Java\javapath\java.exe - False + MSBuild:Compile - C:\antlr\antlr-4.12.0-complete.jar - C:\Program Files\Common Files\Oracle\Java\javapath\java.exe - False + MSBuild:Compile + true - - - - - diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..117aa90 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +services: + janksql: + build: . + volumes: + # Mount a volume for persistent data storage + - janksql_data:/data + stdin_open: true + tty: true + + # Service for running tests + janksql-test: + build: . + container_name: janksql-test + entrypoint: ["dotnet", "test", "/app/Tests/Tests.csproj", "-c", "Release"] + volumes: + - .:/app/source:ro + +volumes: + janksql_data: