Co-authored-by: Swedish Wiking <121635232+Swedish-Wiking@users.noreply.github.com> Co-authored-by: Pyro <pyrodd@gmail.com> Co-authored-by: Kevin B. <kurami32_kbm@proton.me> Co-authored-by: lps-rocks <10893911+lps-rocks@users.noreply.github.com> Co-authored-by: contributor <foss.contributor@gmail.com> Co-authored-by: Ironic <202444094+YoureIronic@users.noreply.github.com> Co-authored-by: Sarabanga <96509626+Sarabanga@users.noreply.github.com> Co-authored-by: ✿ corey <corey@x64.co>
44 lines
1.7 KiB
Docker
44 lines
1.7 KiB
Docker
FROM golang:alpine AS base
|
|
ARG VERSION
|
|
ARG REVISION
|
|
WORKDIR /app
|
|
COPY ./backend ./
|
|
RUN apk update && apk add upx
|
|
ENV GOEXPERIMENT=greenteagc
|
|
RUN go build -ldflags="-w -s \
|
|
-X 'github.com/gtsteffaniak/filebrowser/backend/common/version.Version=${VERSION}' \
|
|
-X 'github.com/gtsteffaniak/filebrowser/backend/common/version.CommitSHA=${REVISION}'" \
|
|
-o filebrowser .
|
|
RUN upx filebrowser
|
|
|
|
FROM node:jod-slim AS nbuild
|
|
WORKDIR /app
|
|
COPY ./frontend/package.json ./
|
|
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
|
|
&& git config --global url."https://github.com/".insteadOf "git@github.com:" \
|
|
&& git config --global url."https://github.com/".insteadOf "ssh://git@github.com/"
|
|
RUN npm i --maxsockets 1
|
|
COPY ./frontend/ ./
|
|
RUN npm run build:docker
|
|
|
|
FROM alpine:latest
|
|
ENV FILEBROWSER_DATABASE="/home/filebrowser/data/database.db"
|
|
ENV PATH="$PATH:/home/filebrowser"
|
|
RUN apk --no-cache add ca-certificates mailcap tzdata curl
|
|
RUN adduser -D -s /bin/true -u 1000 filebrowser
|
|
USER filebrowser
|
|
WORKDIR /home/filebrowser
|
|
COPY --from=base --chown=filebrowser:1000 [ "/app/filebrowser", "./" ]
|
|
COPY --from=base --chown=filebrowser:1000 [ "/app/config.yaml", "./data/config.yaml" ]
|
|
COPY --from=base --chown=filebrowser:1000 [ "/app/config.yaml", "./" ]
|
|
COPY --from=base --chown=filebrowser:1000 [ "/app/reduce-rounded-corners.css", "./" ]
|
|
COPY --from=nbuild --chown=filebrowser:1000 [ "/app/dist/", "./http/dist/" ]
|
|
## sanity checks
|
|
RUN [ "filebrowser", "version" ]
|
|
USER root
|
|
# exposing default port for auto discovery.
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD curl -f http://localhost:80/health || exit 1
|
|
ENTRYPOINT [ "./filebrowser" ]
|