Skip to content

Commit

Permalink
Add Docker container for easier usage
Browse files Browse the repository at this point in the history
  • Loading branch information
devnoname120 committed Sep 20, 2024
1 parent 923f36d commit e1d8a57
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion hasm-vscode/scripts/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface BytecodeDefinitionFile {

const fileExists = async (path: string) => !!(await fs.stat(path).catch((_) => false));

const outputDirectory = path.join(lspDir, 'bin', 'Debug', 'net5.0');
const outputDirectory = path.join(lspDir, 'bin', 'Debug', 'net8.0');
const destDirectory = path.join(process.cwd(), 'client', 'out', 'lsp');
if (!fileExists(destDirectory)) {
fs.mkdir(destDirectory, {
Expand Down
17 changes: 17 additions & 0 deletions hasmer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /source

COPY hasmer.sln hasmer.sln
COPY hasmer-lsp/hasmer-lsp.csproj hasmer-lsp/hasmer-lsp.csproj
COPY hasmer-cli/hasmer-cli.csproj hasmer-cli/hasmer-cli.csproj
COPY libhasmer/libhasmer.csproj libhasmer/libhasmer.csproj
RUN dotnet restore "hasmer.sln"

COPY . .
RUN dotnet publish -o /app


FROM mcr.microsoft.com/dotnet/runtime:8.0
WORKDIR /assets
COPY --from=build /app /app
ENTRYPOINT ["/app/hasmer"]
16 changes: 15 additions & 1 deletion hasmer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,24 @@ This directory contains the C# source code for `hasmer`, using the .NET 8.0 plat

# Setup

You will need the .NET 8 SDK to compile this project. See the [.NET SDK download page](https://dotnet.microsoft.com/en-us/download) for information on how to download the .NET SDK for your operating system.
If you don't use the Docker image then you will need to install the .NET 8 SDK to compile this project. See the [.NET SDK download page](https://dotnet.microsoft.com/en-us/download) for information on how to download the .NET SDK for your operating system.

# Building

## Using Docker

```
docker build -t hasmer .
```

From the directory where your bundle is you can then run commands, for example:

```
docker run --volume $(pwd):/assets hasmer disassemble -i index.android.bundle
```

## Manually

You can open the solution file (see `hasmer.sln`) in Visual Studio and build and run from Visual Studio.

You can also build from the command line using the .NET SDK CLI:
Expand Down
4 changes: 2 additions & 2 deletions hasmer/hasmer-cli/hasmer-cli.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Hasmer.CLI</RootNamespace>
<AssemblyName>hasmer</AssemblyName>
<PublishAot>true</PublishAot>
<PublishAot>false</PublishAot>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit e1d8a57

Please sign in to comment.