forked from slskd/slskd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
90 lines (72 loc) · 2.71 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# build static web content
# note: pin this to amd64 to speed it up, it is prohibitively slow under QEMU
FROM --platform=$BUILDPLATFORM node:18-alpine3.18 AS web
ARG VERSION=0.0.1.65534-local
WORKDIR /slskd
COPY bin bin/.
COPY src/web src/web/.
RUN sh ./bin/build --web-only --version $VERSION
# build, test, and publish application binaries
# note: this needs to be pinned to an amd64 image in order to publish armv7 binaries
# https://github.com/dotnet/dotnet-docker/issues/1537#issuecomment-615269150
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS publish
ARG TARGETPLATFORM
ARG VERSION=0.0.1.65534-local
WORKDIR /slskd
COPY LICENSE .
COPY bin bin/.
COPY config config/.
COPY src/slskd src/slskd/.
COPY tests tests/.
COPY --from=web /slskd/src/web/build /slskd/src/slskd/wwwroot/.
RUN bash ./bin/build --dotnet-only --version $VERSION
RUN bash ./bin/publish --no-prebuild --platform $TARGETPLATFORM --version $VERSION --output ../../dist/${TARGETPLATFORM}
# application
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-bookworm-slim AS slskd
ARG TARGETPLATFORM
ARG TAG=0.0.1
ARG VERSION=0.0.1.65534-local
ARG REVISION=0
ARG BUILD_DATE
RUN apt-get update && apt-get install --no-install-recommends -y \
wget \
tini \
&& \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/cache/apt/* \
/var/tmp/*
RUN bash -c 'mkdir -p /app/{incomplete,downloads} \
&& chmod -R 777 /app \
&& mkdir -p /.net \
&& chmod 777 /.net'
VOLUME /app
HEALTHCHECK --interval=60s --timeout=3s --start-period=5s --retries=3 CMD wget -q -O - http://localhost:${SLSKD_HTTP_PORT}/health
ENV DOTNET_BUNDLE_EXTRACT_BASE_DIR=/.net \
DOTNET_gcServer=0 \
DOTNET_gcConcurrent=1 \
DOTNET_GCHeapHardLimit=1F400000 \
DOTNET_GCConserveMemory=9 \
SLSKD_HTTP_PORT=5030 \
SLSKD_HTTPS_PORT=5031 \
SLSKD_SLSK_LISTEN_PORT=50300 \
SLSKD_APP_DIR=/app \
SLSKD_DOCKER_TAG=$TAG \
SLSKD_DOCKER_VERSION=$VERSION \
SLSKD_DOCKER_REVISON=$REVISION \
SLSKD_DOCKER_BUILD_DATE=$BUILD_DATE
LABEL org.opencontainers.image.title=slskd \
org.opencontainers.image.description="A modern client-server application for the Soulseek file sharing network" \
org.opencontainers.image.authors="slskd Team" \
org.opencontainers.image.vendor="slskd Team" \
org.opencontainers.image.licenses=AGPL-3.0 \
org.opencontainers.image.url=https://slskd.org \
org.opencontainers.image.source=https://github.com/slskd/slskd \
org.opencontainers.image.documentation=https://github.com/slskd/slskd \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.revision=$REVISION \
org.opencontainers.image.created=$BUILD_DATE
WORKDIR /slskd
COPY --from=publish /slskd/dist/${TARGETPLATFORM} .
ENTRYPOINT ["/usr/bin/tini", "--", "./slskd"]