~emersion/soju-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 3

[PATCH soju] contrib: add docker buildfile

Details
Message ID
<20240129063808.3601139-1-moritz@poldrack.dev>
DKIM signature
pass
Download raw message
Patch: +22 -0
From: Moritz Poldrack <git@moritz.sh>

Signed-off-by: Moritz Poldrack <git@moritz.sh>
---

As suggested by f_ on IRC

 contrib/docker/Dockerfile         | 11 +++++++++++
 contrib/docker/docker-compose.yml | 11 +++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 contrib/docker/Dockerfile
 create mode 100644 contrib/docker/docker-compose.yml

diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile
new file mode 100644
index 0000000..6c88495
--- /dev/null
+++ b/contrib/docker/Dockerfile
@@ -0,0 +1,11 @@
FROM alpine:edge

RUN apk add --no-cache git && git clone https://git.sr.ht/~emersion/soju /src && apk del git
RUN apk add --no-cache go sqlite sqlite-libs sqlite-dev
RUN apk add --no-cache git make && cd /src; GOFLAGS='-trimpath -tags=libsqlite3' make soju sojuctl && apk del make
RUN chmod a+w /src/cmd/soju /src/cmd/sojuctl
RUN mv /src/soju /src/sojuctl /src/sojudb /bin

EXPOSE 6697

ENTRYPOINT ["soju", "-config", "/data/config"]
diff --git a/contrib/docker/docker-compose.yml b/contrib/docker/docker-compose.yml
new file mode 100644
index 0000000..5c4d9e7
--- /dev/null
+++ b/contrib/docker/docker-compose.yml
@@ -0,0 +1,11 @@
version: "3.9"
services:
  soju:
    build: .
    #image: mpldr/soju:latest
    command:
      - -debug
    ports:
      - "6697:6697"
    volumes:
      - ./soju-data:/data
-- 
2.43.0

[soju/patches/.build.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CYQZFTD8C74O.1FXVMGBP2MSRN@fra01>
In-Reply-To
<20240129063808.3601139-1-moritz@poldrack.dev> (view parent)
DKIM signature
missing
Download raw message
soju/patches/.build.yml: SUCCESS in 1m8s

[contrib: add docker buildfile][0] from [Moritz Poldrack][1]

[0]: https://lists.sr.ht/~emersion/soju-dev/patches/48981
[1]: moritz@poldrack.dev

✓ #1139512 SUCCESS soju/patches/.build.yml https://builds.sr.ht/~emersion/job/1139512
Details
Message ID
<CYR0703V1OC9.2IZXO9TLDB6FG@ayaya.dev>
In-Reply-To
<20240129063808.3601139-1-moritz@poldrack.dev> (view parent)
DKIM signature
pass
Download raw message
On Mon Jan 29, 2024 at 6:36 AM UTC, Moritz Poldrack wrote:
> From: Moritz Poldrack <git@moritz.sh>
>
> Signed-off-by: Moritz Poldrack <git@moritz.sh>
> ---
>
> As suggested by f_ on IRC
>
>  contrib/docker/Dockerfile         | 11 +++++++++++
>  contrib/docker/docker-compose.yml | 11 +++++++++++
>  2 files changed, 22 insertions(+)
>  create mode 100644 contrib/docker/Dockerfile
>  create mode 100644 contrib/docker/docker-compose.yml
>
> diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile
> new file mode 100644
> index 0000000..6c88495
> --- /dev/null
> +++ b/contrib/docker/Dockerfile
> @@ -0,0 +1,11 @@
> +FROM alpine:edge
> +
> +RUN apk add --no-cache git && git clone https://git.sr.ht/~emersion/soju /src && apk del git
> +RUN apk add --no-cache go sqlite sqlite-libs sqlite-dev

sqlite-libs already comes with sqlite-dev

but then also none of the resulting dev dependencies are cleaned up at the
bottom, so go+gcc is still installed and just bloats the container size. it's
strange seeing three separate installs + two apk del invocations but still leave
this around for no reason. normally you use 2 build stages for this instead.

> +RUN apk add --no-cache git make && cd /src; GOFLAGS='-trimpath -tags=libsqlite3' make soju sojuctl && apk del make
> +RUN chmod a+w /src/cmd/soju /src/cmd/sojuctl
> +RUN mv /src/soju /src/sojuctl /src/sojudb /bin
> +
> +EXPOSE 6697
> +
> +ENTRYPOINT ["soju", "-config", "/data/config"]
> diff --git a/contrib/docker/docker-compose.yml b/contrib/docker/docker-compose.yml
> new file mode 100644
> index 0000000..5c4d9e7
> --- /dev/null
> +++ b/contrib/docker/docker-compose.yml
> @@ -0,0 +1,11 @@
> +version: "3.9"
> +services:
> +  soju:
> +    build: .
> +    #image: mpldr/soju:latest

this looks like a debug comment?

> +    command:
> +      - -debug
> +    ports:
> +      - "6697:6697"
> +    volumes:
> +      - ./soju-data:/data
Details
Message ID
<f71b396d-782e-4749-86b8-bd26e92710a5@poldrack.dev>
In-Reply-To
<CYR0703V1OC9.2IZXO9TLDB6FG@ayaya.dev> (view parent)
DKIM signature
pass
Download raw message
29 Jan 2024 08:15:13 alice <alice@ayaya.dev>:

> On Mon Jan 29, 2024 at 6:36 AM UTC, Moritz Poldrack wrote:
>> From: Moritz Poldrack <git@moritz.sh>
>>
>> Signed-off-by: Moritz Poldrack <git@moritz.sh>
>> ---
>>
>> As suggested by f_ on IRC
>>
>> contrib/docker/Dockerfile         | 11 +++++++++++
>> contrib/docker/docker-compose.yml | 11 +++++++++++
>> 2 files changed, 22 insertions(+)
>> create mode 100644 contrib/docker/Dockerfile
>> create mode 100644 contrib/docker/docker-compose.yml
>>
>> diff --git a/contrib/docker/Dockerfile b/contrib/docker/Dockerfile
>> new file mode 100644
>> index 0000000..6c88495
>> --- /dev/null
>> +++ b/contrib/docker/Dockerfile
>> @@ -0,0 +1,11 @@
>> +FROM alpine:edge
>> +
>> +RUN apk add --no-cache git && git clone 
>> https://git.sr.ht/~emersion/soju /src && apk del git
>> +RUN apk add --no-cache go sqlite sqlite-libs sqlite-dev
>
> sqlite-libs already comes with sqlite-dev
>
> but then also none of the resulting dev dependencies are cleaned up at 
> the
> bottom, so go+gcc is still installed and just bloats the container 
> size. it's
> strange seeing three separate installs + two apk del invocations but 
> still leave
> this around for no reason. normally you use 2 build stages for this 
> instead.

You're right, I could probably also just throw it inside a scratch 
container. That should at least geht rid of the pull issues because of 
CVEs

>
>> +RUN apk add --no-cache git make && cd /src; GOFLAGS='-trimpath 
>> -tags=libsqlite3' make soju sojuctl && apk del make
>> +RUN chmod a+w /src/cmd/soju /src/cmd/sojuctl
>> +RUN mv /src/soju /src/sojuctl /src/sojudb /bin
>> +
>> +EXPOSE 6697
>> +
>> +ENTRYPOINT ["soju", "-config", "/data/config"]
>> diff --git a/contrib/docker/docker-compose.yml 
>> b/contrib/docker/docker-compose.yml
>> new file mode 100644
>> index 0000000..5c4d9e7
>> --- /dev/null
>> +++ b/contrib/docker/docker-compose.yml
>> @@ -0,0 +1,11 @@
>> +version: "3.9"
>> +services:
>> +  soju:
>> +    build: .
>> +    #image: mpldr/soju:latest
>
> this looks like a debug comment?

Not quite, I also use this for deployment on my server. In that case I 
don't build the container anew, but instead just pull the image. Could 
probably remove it though.

>
>> +    command:
>> +      - -debug
>> +    ports:
>> +      - "6697:6697"
>> +    volumes:
>> +      - ./soju-data:/data


-- 
Moritz Poldrack
https://moritz.sh
Reply to thread Export thread (mbox)