Skip to content

Commit 2b7185f

Browse files
authored
musl compability + alpine dockerfile (#1115)
1 parent cd5227a commit 2b7185f

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

packaging/alpine/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM 84codes/crystal:latest-alpine AS builder
2+
RUN apk add lz4-dev
3+
WORKDIR /tmp
4+
COPY shard.yml shard.lock .
5+
RUN shards install --production
6+
COPY ./static ./static
7+
COPY ./views ./views
8+
COPY ./src ./src
9+
COPY Makefile .
10+
ARG MAKEFLAGS=-j2
11+
RUN make all
12+
13+
FROM alpine:latest
14+
RUN apk add openssl lz4-libs pcre2 libgcc
15+
COPY --from=builder /tmp/bin/* /usr/bin/
16+
EXPOSE 5672 15672
17+
VOLUME /var/lib/lavinmq
18+
WORKDIR /var/lib/lavinmq
19+
ENV GC_UNMAP_THRESHOLD=1
20+
HEALTHCHECK CMD ["/usr/bin/lavinmqctl", "status"]
21+
ENTRYPOINT ["/usr/bin/lavinmq", "-b", "0.0.0.0", "--guest-only-loopback=false"]

src/stdlib/filesystem.cr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ lib LibC
1717
spare : StaticArray(Long, 4)
1818
end
1919

20-
fun statfs64(file : Char*, buf : Statfs*) : Int
20+
{% if flag?(:musl) %}
21+
fun statfs(file : Char*, buf : Statfs*) : Int
22+
{% else %}
23+
fun statfs64(file : Char*, buf : Statfs*) : Int
24+
{% end %}
2125
{% elsif flag?(:darwin) %}
2226
struct Statfs
2327
bsize : UInt32
@@ -85,7 +89,7 @@ struct FilesystemInfo
8589
getter total : UInt64
8690
end
8791

88-
{% if flag?(:linux) || flag?(:darwin) %}
92+
{% if (flag?(:linux) && !flag?(:musl)) || flag?(:darwin) %}
8993
module Filesystem
9094
def self.info(path)
9195
statfs = uninitialized LibC::Statfs
@@ -95,7 +99,7 @@ end
9599
FilesystemInfo.new(statfs)
96100
end
97101
end
98-
{% elsif flag?(:freebsd) %}
102+
{% elsif flag?(:freebsd) || flag?(:musl) %}
99103
module Filesystem
100104
def self.info(path)
101105
statfs = uninitialized LibC::Statfs

0 commit comments

Comments
 (0)