Upgrade to go1.16, use go:embed for bundling assets (#555)

This commit is contained in:
andig 2021-02-21 11:15:52 +01:00 • committed by GitHub
parent b2ddbd4ff7
commit 3bb58e59e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 474 additions and 15605 deletions

View file

@ -1,37 +1,52 @@
############################
# STEP 1 build executable binary
############################
FROM golang:1.14-alpine as builder
# STEP 1 build ui
FROM node:14-alpine as node
# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
# Ca-certificates is required to call HTTPS endpoints.
RUN apk update && apk add --no-cache git ca-certificates tzdata alpine-sdk npm && update-ca-certificates
RUN apk update && apk add --no-cache make
WORKDIR /build
# cache modules
COPY go.mod .
COPY go.sum .
RUN go mod download
# install go and node tools
# install node tools
COPY Makefile .
COPY package*.json ./
RUN make install
RUN make install-ui
# build ui
COPY assets assets
COPY vue.config.js vue.config.js
RUN make clean npm
RUN make clean ui
# STEP 2 build executable binary
FROM golang:1.16-alpine as builder
# Install git + SSL ca certificates.
# Git is required for fetching the dependencies.
# Ca-certificates is required to call HTTPS endpoints.
RUN apk update && apk add --no-cache git ca-certificates tzdata alpine-sdk && update-ca-certificates
WORKDIR /build
# install go tools and cache modules
COPY Makefile .
COPY go.mod .
COPY go.sum .
RUN make install
RUN go mod download
# prepare
COPY . .
RUN make assets
# copy ui
COPY --from=node /build/dist /build/dist
# build
COPY . .
RUN make assets
RUN GOARCH={{ .GoARCH }} GOARM={{ .GoARM }} make build
#############################
## STEP 2 build a small image
#############################
# STEP 3 build a small image including module support
FROM {{ .RuntimeImage }}
ENV TZ=Europe/Berlin