diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..f0f644e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +LICENSE +README.md diff --git a/.gitignore b/.gitignore index 4de7fa5..6ef3500 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,3 @@ package-lock.json fly.toml *.fiber.gz soundcloak.json -Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..328a82c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +ARG GO_VERSION=1.21.3 +ARG NODE_VERSION=bookworm + +FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build +ARG TARGETOS +ARG TARGETARCH + +WORKDIR /build +COPY . . +RUN go install github.com/a-h/templ/cmd/templ@latest && \ + templ generate && \ + CGO_ENABLED=0 GOARCH=${TARGETARCH} GOOS=${TARGETOS} go build -ldflags "-s -w -extldflags '-static'" -o ./app + +FROM node:${NODE_VERSION} AS node +WORKDIR /hls.js +COPY --from=build /build/package.json ./ +RUN npm i + +FROM scratch + +COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=build /build/assets /assets +COPY --from=build /build/app /app +COPY --from=node /hls.js/node_modules /node_modules + +EXPOSE 4664 + +ENTRYPOINT ["/app"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..97f5437 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,13 @@ +services: + soundcloak: + container_name: soundcloak + restart: unless-stopped + build: . + ports: + - "127.0.0.1:4664:4664" + cap_drop: + - ALL + security_opt: + - no-new-privileges:true + volumes: + - ./soundcloak.json:/soundcloak.json