embed and build.
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
## 1. Build Frontend
|
||||
FROM node:20-alpine3.18 AS build-frontend
|
||||
WORKDIR /project
|
||||
COPY . .
|
||||
ENV CGO_ENABLED 0
|
||||
RUN cd frontend && npm install && rm -rf ./build && npm run build
|
||||
|
||||
## 2. Build server
|
||||
FROM golang:1.20 AS build-server
|
||||
WORKDIR /project
|
||||
COPY . .
|
||||
COPY --from=build-frontend /project/frontend/build /project/frontend/build
|
||||
ENV CGO_ENABLED 0
|
||||
RUN go mod download
|
||||
RUN go build -ldflags "-w -s" -o /build/lucifer4 cmd/lucifer4-server/main.go
|
||||
|
||||
## 3. Run server
|
||||
FROM alpine:3.18.4
|
||||
# Add results from previous builds
|
||||
COPY --from=build-server /build/lucifer4 /usr/local/bin/lucifer4
|
||||
RUN apk add --no-cache tzdata
|
||||
# Run server
|
||||
CMD lucifer4
|
||||
Reference in New Issue
Block a user