2022-12-15 22:23:34 +08:00
|
|
|
# the frontend builder
|
|
|
|
# cloudreve need node.js 16* to build frontend,
|
2023-02-08 13:57:21 +08:00
|
|
|
# !!! Doesn't require any cleanup, as multi-stage builds are removed after completion
|
|
|
|
FROM node:16-alpine as frontend_builder
|
2020-09-03 12:05:00 +08:00
|
|
|
|
2023-02-08 13:57:21 +08:00
|
|
|
RUN set -e \
|
|
|
|
&& apk update \
|
|
|
|
&& apk add bash wget curl git zip \
|
|
|
|
&& sh -c "$(curl -sSL https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
|
|
|
|
# Maybe copying the current directory is more accurate?
|
|
|
|
# && git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git /cloudreve
|
2020-09-03 12:05:00 +08:00
|
|
|
|
2023-02-08 13:57:21 +08:00
|
|
|
COPY . /cloudreve
|
|
|
|
|
|
|
|
WORKDIR /cloudreve
|
|
|
|
|
|
|
|
RUN task clean-frontend build-frontend
|
2020-09-03 12:05:00 +08:00
|
|
|
|
2021-11-20 17:43:31 +08:00
|
|
|
|
2022-12-15 22:23:34 +08:00
|
|
|
# the backend builder
|
|
|
|
# cloudreve backend needs golang 1.18* to build
|
2023-02-08 13:57:21 +08:00
|
|
|
# !!! Doesn't require any cleanup, as multi-stage builds are removed after completion
|
|
|
|
FROM golang:1.18-alpine as backend_builder
|
2022-07-12 19:20:14 +08:00
|
|
|
|
2022-12-15 22:23:34 +08:00
|
|
|
# install dependencies and build tools
|
2023-02-08 13:57:21 +08:00
|
|
|
RUN set -e \
|
|
|
|
&& apk update \
|
|
|
|
&& apk add bash wget curl git build-base \
|
|
|
|
&& sh -c "$(curl -sSL https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
|
|
|
|
# Maybe copying the current directory is more accurate?
|
|
|
|
# && git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git /cloudreve
|
2020-09-03 12:05:00 +08:00
|
|
|
|
2023-02-08 13:57:21 +08:00
|
|
|
COPY . /cloudreve
|
|
|
|
|
|
|
|
WORKDIR /cloudreve
|
2020-09-03 12:05:00 +08:00
|
|
|
|
2023-02-08 13:57:21 +08:00
|
|
|
COPY --from=frontend_builder /cloudreve/assets.zip ./
|
2020-09-03 12:05:00 +08:00
|
|
|
|
2023-02-08 13:57:21 +08:00
|
|
|
RUN task clean-backend build-backend "PLATFORM=docker"
|
|
|
|
|
|
|
|
|
|
|
|
# the final builder
|
2022-04-11 22:13:33 +08:00
|
|
|
FROM alpine:latest
|
2020-09-09 14:56:14 +08:00
|
|
|
|
2022-04-11 22:13:33 +08:00
|
|
|
WORKDIR /cloudreve
|
2022-12-15 22:23:34 +08:00
|
|
|
|
2023-02-08 13:57:21 +08:00
|
|
|
COPY --from=backend_builder /cloudreve/release/cloudreve-docker ./cloudreve
|
|
|
|
|
|
|
|
# !!! For i18n users, do not set timezone
|
|
|
|
RUN set -e \
|
|
|
|
&& apk update \
|
|
|
|
&& apk add bash ca-certificates tzdata \
|
|
|
|
&& rm -f /var/cache/apk/*
|
2020-09-09 14:56:14 +08:00
|
|
|
|
2022-04-11 22:13:33 +08:00
|
|
|
EXPOSE 5212
|
2023-02-08 13:57:21 +08:00
|
|
|
|
2022-04-11 22:13:33 +08:00
|
|
|
VOLUME ["/cloudreve/uploads", "/cloudreve/avatar", "/data"]
|
2020-09-09 14:56:14 +08:00
|
|
|
|
2022-07-12 19:20:14 +08:00
|
|
|
ENTRYPOINT ["./cloudreve"]
|