FROM node:14-alpine3.14 AS node-builder RUN apk --no-cache --virtual build-dependencies add \ g++ \ make WORKDIR /app COPY frontend/ . ARG API_URL ENV REACT_APP_API_URL=$API_URL RUN yarn install RUN yarn build FROM golang:1.17.3-alpine3.14 as go-builder ENV GOPATH "" RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest WORKDIR /app ADD backend/go.mod backend/go.sum ./ RUN go mod download ADD backend/ . RUN go build -o ./clipper ./cmd/clipper/ FROM alpine:3.14 RUN apk add ffmpeg COPY backend/sql/migrations /app/migrations COPY --from=go-builder /app/clipper /bin/clipper COPY --from=go-builder /root/go/bin/migrate /bin/migrate COPY --from=node-builder /app/build /app/assets ENV ASSETS_HTTP_BASE_PATH "/app/assets" ENTRYPOINT ["/bin/clipper"]