2021-10-22 02:14:08 +00:00
|
|
|
# This dockerfile should be built with `make docker-build` from the stash root.
|
2020-02-24 00:40:56 +00:00
|
|
|
|
2021-09-08 05:30:15 +00:00
|
|
|
# Build Frontend
|
|
|
|
FROM node:alpine as frontend
|
2023-07-14 03:04:57 +00:00
|
|
|
RUN apk add --no-cache make git
|
2021-09-08 05:30:15 +00:00
|
|
|
## cache node_modules separately
|
|
|
|
COPY ./ui/v2.5/package.json ./ui/v2.5/yarn.lock /stash/ui/v2.5/
|
|
|
|
WORKDIR /stash
|
|
|
|
COPY Makefile /stash/
|
|
|
|
COPY ./graphql /stash/graphql/
|
|
|
|
COPY ./ui /stash/ui/
|
2023-07-14 03:05:33 +00:00
|
|
|
RUN make pre-ui
|
2023-07-12 00:05:35 +00:00
|
|
|
RUN make generate-ui
|
2021-10-22 02:14:08 +00:00
|
|
|
ARG GITHASH
|
|
|
|
ARG STASH_VERSION
|
2021-09-22 03:08:34 +00:00
|
|
|
RUN BUILD_DATE=$(date +"%Y-%m-%d %H:%M:%S") make ui
|
2021-09-08 05:30:15 +00:00
|
|
|
|
|
|
|
# Build Backend
|
2022-11-09 03:41:23 +00:00
|
|
|
FROM golang:1.19-alpine as backend
|
2021-10-22 02:14:08 +00:00
|
|
|
RUN apk add --no-cache make alpine-sdk
|
2020-02-24 00:40:56 +00:00
|
|
|
WORKDIR /stash
|
2021-09-08 05:30:15 +00:00
|
|
|
COPY ./go* ./*.go Makefile gqlgen.yml .gqlgenc.yml /stash/
|
|
|
|
COPY ./scripts /stash/scripts/
|
|
|
|
COPY ./pkg /stash/pkg/
|
2022-03-23 02:35:42 +00:00
|
|
|
COPY ./cmd /stash/cmd
|
|
|
|
COPY ./internal /stash/internal
|
2021-09-08 05:30:15 +00:00
|
|
|
COPY --from=frontend /stash /stash/
|
|
|
|
RUN make generate-backend
|
2021-10-22 02:14:08 +00:00
|
|
|
ARG GITHASH
|
|
|
|
ARG STASH_VERSION
|
2023-11-21 20:08:00 +00:00
|
|
|
RUN make flags-release flags-pie stash
|
2020-02-24 00:40:56 +00:00
|
|
|
|
2021-09-08 05:30:15 +00:00
|
|
|
# Final Runnable Image
|
|
|
|
FROM alpine:latest
|
2021-10-22 02:14:08 +00:00
|
|
|
RUN apk add --no-cache ca-certificates vips-tools ffmpeg
|
|
|
|
COPY --from=backend /stash/stash /usr/bin/
|
2021-04-11 23:31:33 +00:00
|
|
|
ENV STASH_CONFIG_FILE=/root/.stash/config.yml
|
2020-02-24 00:40:56 +00:00
|
|
|
EXPOSE 9999
|
2022-03-23 02:35:42 +00:00
|
|
|
ENTRYPOINT ["stash"]
|