-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
44 lines (32 loc) · 1.33 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
# Node ------------------------------------------------------------------------
FROM node:20-slim AS ui
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /usr/src/strumm
WORKDIR /usr/src/strumm/cmd/web/ui
RUN rm -rf node_modules
RUN pnpm install
RUN pnpm install -D @rollup/rollup-linux-x64-gnu
RUN pnpm install -D @rollup/rollup-linux-arm64-gnu
RUN pnpm run build
# -----------------------------------------------------------------------------
# Go --------------------------------------------------------------------------
FROM golang:alpine AS build
COPY . /usr/src/strumm
COPY --from=ui /usr/src/strumm/cmd/web/ui/dist /usr/src/strumm/cmd/web/ui/dist
WORKDIR /usr/src/strumm
RUN CGO_ENABLED=0 GOOS=linux go build -o strumm cmd/web/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -o dbseed cmd/db/main.go
# -----------------------------------------------------------------------------
# Bin -------------------------------------------------------------------------
FROM scratch
VOLUME /music /cache
WORKDIR /app
COPY --from=build /usr/src/strumm/strumm /app
COPY --from=build /usr/src/strumm/dbseed /app
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENV JWT_SECRET=secretW
ENV LASTFM_APIKEY=apikey
EXPOSE 8080
ENTRYPOINT [ "./strumm", "-c", "/cache/images", "-d", "/cache/data.db", "-r", "/music"]