build with go-task Signed-off-by: kovacs <mritd@linux.com>pull/1608/head
parent
0f6bef9006
commit
f3433168df
@ -1,49 +1,59 @@
|
|||||||
# the frontend builder
|
# the frontend builder
|
||||||
# cloudreve need node.js 16* to build frontend,
|
# cloudreve need node.js 16* to build frontend,
|
||||||
# separate build step and custom image tag will resolve this
|
# !!! Doesn't require any cleanup, as multi-stage builds are removed after completion
|
||||||
FROM node:16-alpine as cloudreve_frontend_builder
|
FROM node:16-alpine as frontend_builder
|
||||||
|
|
||||||
RUN apk update \
|
RUN set -e \
|
||||||
&& apk add --no-cache wget curl git yarn zip bash \
|
&& apk update \
|
||||||
&& git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git /cloudreve_frontend
|
&& apk add bash wget curl git zip \
|
||||||
|
&& sh -c "$(curl -sSL https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
|
||||||
|
|
||||||
# build frontend assets using build script, make sure all the steps just follow the regular release
|
# && git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git /cloudreve
|
||||||
WORKDIR /cloudreve_frontend
|
|
||||||
ENV GENERATE_SOURCEMAP false
|
COPY . /cloudreve
|
||||||
RUN chmod +x ./build.sh && ./build.sh -a
|
|
||||||
|
WORKDIR /cloudreve
|
||||||
|
|
||||||
|
RUN task build-frontend
|
||||||
|
|
||||||
|
|
||||||
# the backend builder
|
# the backend builder
|
||||||
# cloudreve backend needs golang 1.18* to build
|
# cloudreve backend needs golang 1.18* to build
|
||||||
FROM golang:1.18-alpine as cloudreve_backend_builder
|
# !!! Doesn't require any cleanup, as multi-stage builds are removed after completion
|
||||||
|
FROM golang:1.18-alpine as backend_builder
|
||||||
|
|
||||||
# install dependencies and build tools
|
# install dependencies and build tools
|
||||||
RUN apk update \
|
RUN set -e \
|
||||||
# install dependencies and build tools
|
&& apk update \
|
||||||
&& apk add --no-cache wget curl git build-base gcc abuild binutils binutils-doc gcc-doc zip bash \
|
&& apk add bash wget curl git build-base \
|
||||||
&& git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git /cloudreve_backend
|
&& sh -c "$(curl -sSL https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
|
||||||
|
|
||||||
|
# && git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git /cloudreve
|
||||||
|
|
||||||
WORKDIR /cloudreve_backend
|
COPY . /cloudreve
|
||||||
COPY --from=cloudreve_frontend_builder /cloudreve_frontend/assets.zip ./
|
|
||||||
RUN chmod +x ./build.sh && ./build.sh -c
|
|
||||||
|
|
||||||
|
WORKDIR /cloudreve
|
||||||
|
|
||||||
|
COPY --from=frontend_builder /cloudreve/assets.zip ./
|
||||||
|
|
||||||
|
RUN task build-backend "TASK=docker"
|
||||||
|
|
||||||
# TODO: merge the frontend build and backend build into a single one image
|
|
||||||
# the final published image
|
# the final builder
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
WORKDIR /cloudreve
|
WORKDIR /cloudreve
|
||||||
COPY --from=cloudreve_backend_builder /cloudreve_backend/cloudreve ./cloudreve
|
|
||||||
|
|
||||||
RUN apk update \
|
COPY --from=backend_builder /cloudreve/release/cloudreve-docker ./cloudreve
|
||||||
&& apk add --no-cache tzdata \
|
|
||||||
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
# !!! For i18n users, do not set timezone
|
||||||
&& echo "Asia/Shanghai" > /etc/timezone \
|
RUN set -e \
|
||||||
&& chmod +x ./cloudreve \
|
&& apk update \
|
||||||
&& mkdir -p /data/aria2 \
|
&& apk add bash ca-certificates tzdata \
|
||||||
&& chmod -R 766 /data/aria2
|
&& rm -f /var/cache/apk/*
|
||||||
|
|
||||||
EXPOSE 5212
|
EXPOSE 5212
|
||||||
|
|
||||||
VOLUME ["/cloudreve/uploads", "/cloudreve/avatar", "/data"]
|
VOLUME ["/cloudreve/uploads", "/cloudreve/avatar", "/data"]
|
||||||
|
|
||||||
ENTRYPOINT ["./cloudreve"]
|
ENTRYPOINT ["./cloudreve"]
|
||||||
|
|||||||
Loading…
Reference in new issue