mirror of
https://github.com/datarhei/core.git
synced 2025-09-26 20:11:29 +08:00
39 lines
996 B
Docker
39 lines
996 B
Docker
ARG GOLANG_IMAGE=golang:1.20-alpine3.16
|
|
ARG BUILD_IMAGE=alpine:3.16
|
|
|
|
# Cross-Compilation
|
|
# https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide/
|
|
FROM --platform=$BUILDPLATFORM $GOLANG_IMAGE as builder
|
|
|
|
ARG TARGETOS TARGETARCH
|
|
ENV GOOS=$TARGETOS GOARCH=$TARGETARCH
|
|
|
|
COPY . /dist/core
|
|
|
|
RUN apk add \
|
|
git \
|
|
make && \
|
|
cd /dist/core && \
|
|
go version && \
|
|
make release_linux && \
|
|
make import_linux && \
|
|
make ffmigrate_linux
|
|
|
|
FROM $BUILD_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 mkdir /core/config /core/data
|
|
|
|
ENV CORE_CONFIGFILE=/core/config/config.json
|
|
ENV CORE_STORAGE_DISK_DIR=/core/data
|
|
ENV CORE_DB_DIR=/core/config
|
|
|
|
VOLUME ["/core/data", "/core/config"]
|
|
ENTRYPOINT ["/core/bin/run.sh"]
|
|
WORKDIR /core
|