36 lines
824 B
Docker
36 lines
824 B
Docker
FROM node:24-alpine AS frontend
|
|
|
|
WORKDIR /src/frontend
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
COPY frontend/ ./
|
|
RUN npm run build
|
|
|
|
FROM golang:1.24-alpine AS backend
|
|
|
|
ARG GOPROXY=https://proxy.golang.org,direct
|
|
ENV GOPROXY=${GOPROXY}
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY *.go ./
|
|
COPY --from=frontend /src/frontend/dist ./frontend/dist
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /ufile .
|
|
|
|
FROM alpine:3.22
|
|
|
|
RUN addgroup -S -g 10001 ufile \
|
|
&& adduser -S -D -H -u 10001 -G ufile ufile \
|
|
&& mkdir -p /data \
|
|
&& chown ufile:ufile /data
|
|
|
|
COPY --from=backend --chown=ufile:ufile /ufile /usr/local/bin/ufile
|
|
|
|
USER ufile
|
|
WORKDIR /data
|
|
VOLUME ["/data"]
|
|
EXPOSE 6616
|
|
|
|
CMD ["/usr/local/bin/ufile", "--data", "/data", "--address", "0.0.0.0:6616"]
|