build(docker): build executable in docker

This commit is contained in:
Cory Sanin 2023-08-03 23:01:26 -05:00
parent 0ac39684f1
commit 82f287372c
2 changed files with 54 additions and 5 deletions

View File

@ -1,4 +1,31 @@
*
!docker/*
!docker_config.json
!filebrowser
*.db
*.bak
_old
rice-box.go
.idea/
/filebrowser
/filebrowser.exe
/dist
.DS_Store
node_modules
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
bin/
build/

View File

@ -1,3 +1,25 @@
FROM node:alpine as frontend
WORKDIR /filebrowser/frontend
COPY frontend/ .
# TODO: Remove when frontend dependencies are updated
ENV NODE_OPTIONS --openssl-legacy-provider
RUN npm install && \
npx browserslist@latest --update-db &&\
npm run build
FROM golang:alpine as backend
WORKDIR /filebrowser
COPY . .
COPY --from=frontend /filebrowser /filebrowser
RUN go mod download && \
go build
FROM alpine:latest
RUN apk --update add ca-certificates \
mailcap \
@ -14,6 +36,6 @@ VOLUME /srv
EXPOSE 80
COPY docker_config.json /.filebrowser.json
COPY filebrowser /filebrowser
COPY --from=backend /filebrowser/filebrowser /filebrowser
ENTRYPOINT [ "/filebrowser" ]