You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

35 lines
759 B

FROM node as frontend
WORKDIR /src
COPY ./ui/package.json ./ui/yarn.lock /src/
RUN yarn install
COPY ./ui/ .
RUN yarn build
FROM golang:1.15-alpine as backend
RUN apk add --no-cache git gcc musl-dev
WORKDIR /src
RUN go get github.com/swaggo/swag/cmd/swag
RUN go get github.com/rakyll/statik
COPY go.mod go.sum /src/
RUN go mod download
COPY . .
COPY --from=frontend /src/dist ./ui/dist
RUN go generate
RUN VERSION=$(git describe --tags --abbrev=0)-$(git rev-parse --short HEAD) && \
CGO_ENABLED=1 GOOS=linux \
go build \
-ldflags="-w -X 'github.com/mutsuki333/calendar/main.Version=${VERSION}' -linkmode external -extldflags '-static'" \
-o /calendar main.go
FROM scratch as release
COPY --from=backend /calendar .
CMD ["/calendar"]