From 605970f6b6e4109c9d6f38758b57e7e112fa48c0 Mon Sep 17 00:00:00 2001 From: sh <37271604+shumvgolove@users.noreply.github.com> Date: Mon, 24 Apr 2023 13:10:05 +0300 Subject: [PATCH] docker: refactoring (#735) * build: switch ubuntu image to lunar * dcoker: support multi-platform builds * docker: strip binary * docker: multicore execution * readme: change docker hub to smp-server --- README.md | 4 ++-- build.Dockerfile | 7 +++++-- scripts/docker/entrypoint | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e57672d11..ec40182de 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ apt update && apt install openssl #### Using Docker -On Linux, you can deploy smp server using Docker. This will download image from [Docker Hub](https://hub.docker.com/r/simplexchat/simplexmq). +On Linux, you can deploy smp server using Docker. This will download image from [Docker Hub](https://hub.docker.com/r/simplexchat/smp-server). 1. Create `config` and `logs` directories: @@ -121,7 +121,7 @@ On Linux, you can deploy smp server using Docker. This will download image from -p 5223:5223 \ -v $HOME/simplex/config:/etc/opt/simplex:z \ -v $HOME/simplex/logs:/var/opt/simplex:z \ - simplexchat/simplexmq:latest + simplexchat/smp-server:latest ``` #### Ubuntu diff --git a/build.Dockerfile b/build.Dockerfile index a7d670e25..831adc58a 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -1,5 +1,5 @@ -FROM ubuntu:focal AS final -FROM ubuntu:focal AS build +FROM --platform=$BUILDPLATFORM ubuntu:23.04 AS final +FROM --platform=$BUILDPLATFORM ubuntu:23.04 AS build ### Build stage @@ -23,6 +23,9 @@ WORKDIR /project RUN cabal update RUN cabal install +# Strip the binary from debug symbols to reduce size +RUN strip /root/.cabal/bin/smp-server + ### Final stage FROM final diff --git a/scripts/docker/entrypoint b/scripts/docker/entrypoint index ad3a5f6c8..ba172c2a1 100755 --- a/scripts/docker/entrypoint +++ b/scripts/docker/entrypoint @@ -24,5 +24,5 @@ fi # Finally, run smp-sever. Notice that "exec" here is important: # smp-server replaces our helper script, so that it can catch INT signal -exec smp-server start +exec smp-server start +RTS -N -RTS