Browse Source

Merge branch 'build/docker' into test/dummy-ui

test/dummy-ui
Evan 9 months ago
parent
commit
547a8f22c0
  1. 1
      .dockerignore
  2. 14
      Dockerfile

1
.dockerignore

@ -1,4 +1,5 @@
**/node_modules
**/bin
**/dist
docs
assets

14
Dockerfile

@ -1,3 +1,14 @@
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
@ -10,9 +21,10 @@ 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)-$(git rev-parse --short HEAD) && \
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/cmd.Version=${VERSION}' -X 'github.com/mutsuki333/calendar/services.Version=${VERSION}' -linkmode external -extldflags '-static'" \