spark icon indicating copy to clipboard operation
spark copied to clipboard

Docker image does not work for ARM chips

Open alysivji opened this issue 2 years ago • 3 comments

Describe the bug

The R4 Docker image, sparkfhir/spark:r4-latest, does not work for ARM chips. (I would assume the same is true for STU3 and DSTU2, but I have not tested it)

To Reproduce Steps to reproduce the behavior:

  1. Use an Apple Silicon mac and try to bring up a container using the latest R4 image
curl 'https://raw.githubusercontent.com/FirelyTeam/spark/r4/master/.docker/docker-compose.example.yml' > docker-compose.yml
docker-compose up

Container starts, but logs show that qemu has an error. qemu is the Arm system emulator.

spark_1    | Unhandled exception. System.IO.IOException: Function not implemented
spark_1    |    at System.IO.FileSystemWatcher.StartRaisingEvents()
spark_1    |    at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed()
spark_1    |    at System.IO.FileSystemWatcher.set_EnableRaisingEvents(Boolean value)
spark_1    |    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher()
spark_1    |    at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken(String filter)
spark_1    |    at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch(String filter)
spark_1    |    at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0()
spark_1    |    at Microsoft.Extensions.Primitives.ChangeToken.ChangeTokenRegistration`1..ctor(Func`1 changeTokenProducer, Action`1 changeTokenConsumer, TState state)
spark_1    |    at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
spark_1    |    at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor(FileConfigurationSource source)
spark_1    |    at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder)
spark_1    |    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
spark_1    |    at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
spark_1    |    at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
spark_1    |    at Spark.Web.Program.Main(String[] args) in /src/Spark.Web/Program.cs:line 17
spark_1    | qemu: uncaught target signal 6 (Aborted) - core dumped

Expected behavior

Server should start without an error.

Screenshots

n/a

Spark version

  • Version: 1.5.11

Operating system + Database

  • OS: MacOS on Apple Silicon
  • Database: MongoDB

Container service / Cloud infrastructure: n/a

Additional context

I was able to build a working image using the following Dockerfile:

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.24-buster-slim-arm64v8 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.1.418-buster-arm64v8 AS build
WORKDIR /src
COPY ["./src/Spark.Web/Spark.Web.csproj", "Spark.Web/Spark.Web.csproj"]
COPY ["./src/Spark.Engine/Spark.Engine.csproj", "Spark.Engine/Spark.Engine.csproj"]
COPY ["./src/Spark.Mongo/Spark.Mongo.csproj", "Spark.Mongo/Spark.Mongo.csproj"]
RUN dotnet restore "/src/Spark.Web/Spark.Web.csproj"
COPY ./src .
RUN dotnet build "/src/Spark.Web/Spark.Web.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "/src/Spark.Web/Spark.Web.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .

ENTRYPOINT ["dotnet", "Spark.Web.dll"]

I am temporarily hosting this image on DockerHub (while I work to get a PR in to fix the issue): https://hub.docker.com/repository/docker/alysivji0jasper/sparkfhir-arm

alysivji avatar Apr 22 '22 20:04 alysivji

I would like to help out and fix this issue. Looks like I will have to make the following changes:

  • create a new set of Dockerfile for ARM
    • https://github.com/FirelyTeam/spark/tree/r4/master/.docker
  • update the Docker Release Github Action
    • https://github.com/FirelyTeam/spark/blob/r4/master/.github/workflows/docker_image_linux.yml
  • update README with instructions for ARM processors

Would I need to make this change 3 times, i.e. once for each of the supported FHIR versions?

alysivji avatar Apr 22 '22 20:04 alysivji

Hey @alysivji you can make the change one time for the R4 version, then I will forward your changes and do the necessary amendments for the respective FHIR versions.

kennethmyhra avatar Apr 23 '22 07:04 kennethmyhra

Awesome. Thanks! I will work on this next week and create a PR.

alysivji avatar Apr 23 '22 14:04 alysivji