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.

27 lines
1.1 KiB

FROM node AS Frontend
ADD ./frontend /go/src/
WORKDIR /go/src/
RUN npm install -g parcel-bundler
RUN npm install && \
parcel build index.html
FROM golang AS Backend
ADD .git /go/src/
ADD *.go /go/src/
COPY --from=Frontend /go/src/ /go/src/
WORKDIR /go/src/
RUN echo 'package main \n\nvar gitHash = "'$(git rev-parse HEAD)'" \nvar buildDate = "'$(TZ=":Europe/Berlin" date '+%d.%m.%Y %H:%M %Z')'" \nvar version = "'$(git describe --tags)'"' > version.go
RUN go get && \
/go/bin/go-bindata ./frontend/dist/... && \
go get
RUN CGO_ENABLED=1 GOOS=linux go build -a -ldflags '-extldflags "-static" -s' -installsuffix cgo -o SAM -v .
FROM scratch
COPY --from=Backend /go/src/ /SAM
ADD ./sql /sql
ENV GIN_MODE=release
VOLUME [ "/data" ]