Docker container doesn't start

I am trying to set up a Docker container to run a FiveM server. It succesfully builds, cloning serverdata from github and downloading the latest artifact, but it seems to give a stack overflow error, and it then outputs ‘Ctrl+C pressed in server console’, even though it was never actually pressed. It also seems to have a problem loading webpack, which seems to be an older issue with linux builds. It always stops running at yarn [2/4]. What can be the cause of the issue? Is it caused by webpack not building properly?

FROM alpine AS base

## here it clones default serverdata from github into /SERVER/SERVERDATA/

## here it downloads the latest linux artifact into /SERVER/ARTIFACT/


##----- final build stage -----
FROM base AS final

## Take license key as argument, passed from compose
ARG FX_LICENSE_KEY
ENV FX_LICENSE_KEY=$FX_LICENSE_KEY

## Keep txData between builds
## nothing there yet as it currently starts without txAdmin
VOLUME /SERVER/txData/
## Keep cache for experimental purposes
VOLUME /SERVER/SERVERDATA/cache/

## Set the serverdata folder as work dir
WORKDIR /SERVER/SERVERDATA/

## Install dependencies for server process
RUN apk add --no-cache libgcc libstdc++ ca-certificates bash npm

## Run FXServer with license key
ENTRYPOINT bash /SERVER/ARTIFACT/run.sh +exec server.cfg +set sv_licenseKey ${FX_LICENSE_KEY}
2023-12-07 10:31:30 Stack overflow in unmanaged: IP: 0x7f43c427aeff, fault addr: 0x7ffcac9042a0
2023-12-07 10:31:30 [           resources] Scanning resources.
2023-12-07 10:31:30 [           resources] Found 25 resources.
2023-12-07 10:31:30 [          svadhesive] Authenticating server license key...
2023-12-07 10:31:30 [          svadhesive] Server license key authentication succeeded. Welcome!
2023-12-07 10:31:30 [    c-scripting-core] Creating script environments for sessionmanager
2023-12-07 10:31:30 [           resources] Started resource sessionmanager
2023-12-07 10:31:30 [    c-scripting-core] Creating script environments for mapmanager
2023-12-07 10:31:30 [           resources] Started resource mapmanager
2023-12-07 10:31:30 [    c-scripting-core] Creating script environments for yarn
2023-12-07 10:31:30 [           resources] Started resource yarn
2023-12-07 10:31:30 [ citizen-server-impl] Running build tasks on resource webpack - it'll restart once completed.
2023-12-07 10:31:30 [    c-resources-core] Could not start dependency webpack for resource chat.
2023-12-07 10:31:30 [ citizen-server-impl] Couldn't start resource chat.
2023-12-07 10:31:30 [           resources] Started resource spawnmanager
2023-12-07 10:31:30 [   script:mapmanager] Started gametype Freeroam
2023-12-07 10:31:30 [           resources] Started resource basic-gamemode
2023-12-07 10:31:30 [    c-scripting-core] Creating script environments for hardcap
2023-12-07 10:31:30 [           resources] Started resource hardcap
2023-12-07 10:31:31 [ citizen-server-main] -> Quitting: Ctrl-C pressed in server console.
2023-12-07 10:31:31 [   script:mapmanager] Started map fivem-map-hipster
2023-12-07 10:31:31 [           resources] Started resource fivem-map-hipster
2023-12-07 10:31:31 [ citizen-server-impl]         fff                          
2023-12-07 10:31:31 [ citizen-server-impl]   cccc ff   xx  xx     rr rr    eee  
2023-12-07 10:31:31 [ citizen-server-impl] cc     ffff   xx       rrr  r ee   e 
2023-12-07 10:31:31 [ citizen-server-impl] cc     ff     xx   ... rr     eeeee  
2023-12-07 10:31:31 [ citizen-server-impl]  ccccc ff   xx  xx ... rr      eeeee 
2023-12-07 10:31:31 [ citizen-server-impl]                                      
2023-12-07 10:31:31 [ citizen-server-impl] Authenticated with cfx.re Nucleus: redacted
2023-12-07 10:31:31 [         script:yarn] [yarn]yarn install v1.22.5
2023-12-07 10:31:31 [         script:yarn] [yarn][1/4] Resolving packages...
2023-12-07 10:31:31 [         script:yarn] [yarn][2/4] Fetching packages...

I appreciate all help a lot!

I found a fix!
In the docker compose file, include the following lines:

    stdin_open: true
    tty: true

From: Container crash · Issue #3 · spritsail/fivem · GitHub