ARG GOLANG_IMAGE=golang:1.22-alpine3.19 ARG FFMPEG_IMAGE=datarhei/base:alpine-ffmpeg-latest FROM --platform=$BUILDPLATFORM $GOLANG_IMAGE AS builder RUN apk add git make # Cache go module downloads separately from source code. # This layer only rebuilds when go.mod/go.sum/vendor change. WORKDIR /dist/core COPY go.mod go.sum ./ COPY vendor/ ./vendor/ # Now copy source and build. This layer rebuilds on any .go file change. COPY . . RUN make release && make import && make ffmigrate FROM $FFMPEG_IMAGE COPY --from=builder /dist/core/core /core/bin/core COPY --from=builder /dist/core/import /core/bin/import COPY --from=builder /dist/core/ffmigrate /core/bin/ffmigrate COPY --from=builder /dist/core/mime.types /core/mime.types COPY --from=builder /dist/core/run.sh /core/bin/run.sh RUN chmod +x /core/bin/run.sh && mkdir -p /core/config /core/data ENV CORE_CONFIGFILE=/core/config/config.json ENV CORE_STORAGE_DISK_DIR=/core/data ENV CORE_DB_DIR=/core/config ENV CORE_WHIP_ENABLE=true ENV CORE_WHIP_ADDRESS=:8555 ENV CORE_API_AUTH_ENABLE=false EXPOSE 8080/tcp EXPOSE 8555/tcp VOLUME ["/core/data", "/core/config"] ENTRYPOINT ["/core/bin/run.sh"] WORKDIR /core