You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
945 B
Docker
55 lines
945 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
##
|
|
## Build Backend
|
|
##
|
|
FROM golang:1.18-buster AS build_backend
|
|
ENV GO111MODULE=on \
|
|
CGO_ENABLE=1 \
|
|
GOOS=linux \
|
|
GOARCH=amd64
|
|
WORKDIR /app
|
|
|
|
COPY go.mod .
|
|
COPY go.sum .
|
|
|
|
RUN go mod download
|
|
RUN apt update && apt install -y ca-certificates
|
|
|
|
COPY *.go ./
|
|
COPY auth/. auth/.
|
|
COPY controllers/. controllers/.
|
|
COPY models/. models/.
|
|
COPY server/. server/.
|
|
|
|
RUN go build -a --installsuffix cgo -v -tags netgo -ldflags '-extldflags "-static"' -o /main .
|
|
|
|
##
|
|
## Build Frontend
|
|
##
|
|
FROM node:16 AS build_frontend
|
|
WORKDIR /usr/src/app
|
|
RUN npm install -g pnpm
|
|
|
|
COPY assets/package.json ./
|
|
COPY assets/pnpm-lock.yaml ./
|
|
|
|
RUN pnpm i
|
|
|
|
COPY assets/. .
|
|
|
|
RUN pnpm build
|
|
|
|
##
|
|
## Deploy
|
|
##
|
|
FROM scratch
|
|
LABEL maintainer="Jasper Spahl <jasperspahl@web.de>"
|
|
|
|
ENV WOKABLE_MODE="release"
|
|
WORKDIR /
|
|
COPY --from=build_backend /main ./
|
|
COPY --from=build_frontend /usr/src/app/dist/. assets/dist/.
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT [ "/main" ] |