Cloudreve/Dockerfile
mritd abe90e4c88
chore(build): add go-task support (#1608)
* chore(build): add go-task support

add go-task support

Signed-off-by: kovacs <mritd@linux.com>

* chore(docker): build with go-task

build with go-task

Signed-off-by: kovacs <mritd@linux.com>

* chore(task): support cross compile

support cross compile

Signed-off-by: kovacs <mritd@linux.com>

* chore(task): remove GCC build

remove GCC build

Signed-off-by: kovacs <mritd@linux.com>

* docs(task): update README

update README

Signed-off-by: kovacs <mritd@linux.com>

---------

Signed-off-by: kovacs <mritd@linux.com>
2023-02-08 13:57:21 +08:00

59 lines
1.6 KiB
Docker

# the frontend builder
# cloudreve need node.js 16* to build frontend,
# !!! Doesn't require any cleanup, as multi-stage builds are removed after completion
FROM node:16-alpine as frontend_builder
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
COPY . /cloudreve
WORKDIR /cloudreve
RUN task clean-frontend build-frontend
# the backend builder
# cloudreve backend needs golang 1.18* to build
# !!! 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
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
COPY . /cloudreve
WORKDIR /cloudreve
COPY --from=frontend_builder /cloudreve/assets.zip ./
RUN task clean-backend build-backend "PLATFORM=docker"
# the final builder
FROM alpine:latest
WORKDIR /cloudreve
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/*
EXPOSE 5212
VOLUME ["/cloudreve/uploads", "/cloudreve/avatar", "/data"]
ENTRYPOINT ["./cloudreve"]