This commit is contained in:
+10
-15
@@ -1,33 +1,28 @@
|
||||
# Stage 1: Build frontend
|
||||
FROM node:18-alpine AS frontend-builder
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /app
|
||||
RUN git clone https://gitea.sanplex.xyz/Sansan/MusicFrontend.git
|
||||
WORKDIR /app/MusicFrontend
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
# Generate config.js with empty API_HOSTNAME (relative paths)
|
||||
RUN echo "window.__RUNTIME_CONFIG__ = { API_HOSTNAME: '' };" > dist/config.js
|
||||
|
||||
# Stage 2: Build backend
|
||||
# Stage 1: Build backend
|
||||
FROM golang:1.25-alpine as build_go
|
||||
RUN apk add --no-cache curl
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
COPY cmd/ ./cmd/
|
||||
COPY internal/ ./internal/
|
||||
COPY *.go ./
|
||||
RUN find . -name "*_test.go" -delete && \
|
||||
find . -name "integration_test.go" -delete
|
||||
RUN go install github.com/a-h/templ/cmd/templ@latest
|
||||
RUN templ generate
|
||||
RUN go build -o main cmd/main.go
|
||||
|
||||
# Stage 3: Final image
|
||||
# Stage 2: Final image
|
||||
FROM golang:1.25-alpine
|
||||
EXPOSE 8080
|
||||
VOLUME /sorted
|
||||
VOLUME /characters
|
||||
|
||||
COPY --from=build_go /app/main .
|
||||
COPY --from=frontend-builder /app/MusicFrontend/dist /frontend
|
||||
COPY --from=gitea.sanplex.xyz/sansan/musicfrontend:latest /usr/share/nginx/html /frontend
|
||||
# Generate config.js with empty API_HOSTNAME (relative paths)
|
||||
RUN echo "window.__RUNTIME_CONFIG__ = { API_HOSTNAME: '' };" > /frontend/config.js
|
||||
COPY ./songs/ ./songs/
|
||||
|
||||
ENV PORT 8080
|
||||
|
||||
Reference in New Issue
Block a user