mirror of
https://git.maid.zone/stuff/soundcloak.git
synced 2025-12-16 08:39:37 +05:00
5
This commit is contained in:
44
Dockerfile
44
Dockerfile
@@ -1,4 +1,4 @@
|
||||
ARG GO_VERSION=1.24.4
|
||||
ARG GO_VERSION=1.25.0
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build
|
||||
ARG TARGETOS
|
||||
@@ -6,35 +6,33 @@ ARG TARGETARCH
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN go env -w GOPROXY=direct
|
||||
RUN go install -v github.com/a-h/templ/cmd/templ@latest
|
||||
RUN go install -v github.com/dlclark/regexp2cg@main
|
||||
RUN go env -w GOPROXY=direct && \
|
||||
mkdir /etc2 && \
|
||||
mkdir /etc2/ssl && mkdir /etc2/ssl/certs && \
|
||||
cp /etc/ssl/certs/ca-certificates.crt /etc2/ssl/certs/ca-certificates.crt && \
|
||||
echo "soundcloak:x:5000:5000:Soundcloak user:/:/sbin/nologin" > /etc2/passwd && \
|
||||
echo "soundcloak:x:5000:" > /etc2/group
|
||||
|
||||
COPY go.* .
|
||||
RUN go mod download -x && \
|
||||
go install -v github.com/a-h/templ/cmd/templ@latest && \
|
||||
go install -v github.com/dlclark/regexp2cg@main
|
||||
COPY . .
|
||||
# usually soundcloakctl updates together with soundcloak, so we should redownload it
|
||||
RUN go install -v git.maid.zone/stuff/soundcloakctl@master
|
||||
RUN soundcloakctl js download
|
||||
|
||||
RUN templ generate
|
||||
RUN go generate ./lib/*
|
||||
RUN soundcloakctl config codegen
|
||||
RUN soundcloakctl -nozstd precompress
|
||||
|
||||
RUN CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -v -ldflags "-s -w -extldflags '-static' -X git.maid.zone/stuff/soundcloak/lib/cfg.Commit=`git rev-parse HEAD | head -c 7` -X git.maid.zone/stuff/soundcloak/lib/cfg.Repo=`git remote get-url origin`" -o ./app
|
||||
RUN echo "soundcloak:x:5000:5000:Soundcloak user:/:/sbin/nologin" > /etc/minimal-passwd && \
|
||||
echo "soundcloak:x:5000:" > /etc/minimal-group
|
||||
|
||||
RUN soundcloakctl postbuild
|
||||
RUN go install -v git.maid.zone/stuff/soundcloakctl@master && \
|
||||
soundcloakctl js download && \
|
||||
templ generate && \
|
||||
go generate ./lib/* && \
|
||||
soundcloakctl config codegen && \
|
||||
soundcloakctl -nozstd precompress && \
|
||||
CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -v -ldflags "-s -w -extldflags '-static' -X git.maid.zone/stuff/soundcloak/lib/cfg.Commit=`git rev-parse HEAD | head -c 7` -X git.maid.zone/stuff/soundcloak/lib/cfg.Repo=`git remote get-url origin`" -o ./app && \
|
||||
soundcloakctl postbuild
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=build /build/static/assets /static/assets
|
||||
COPY --from=build /build/static/instance /static/instance
|
||||
COPY --from=build /build/static/external /static/external
|
||||
COPY --from=build /build/static/ /static/
|
||||
COPY --from=build /build/app /app
|
||||
COPY --from=build /etc/minimal-passwd /etc/passwd
|
||||
COPY --from=build /etc/minimal-group /etc/group
|
||||
COPY --from=build /etc2/ /etc/
|
||||
|
||||
EXPOSE 4664
|
||||
|
||||
|
||||
Reference in New Issue
Block a user