Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker container for easier usage #6

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oversight?

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
devnoname120 marked this conversation as resolved.
Show resolved Hide resolved


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>
devnoname120 marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup>
Expand Down