-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use scripts.sh to build within Docker
Docker currently duplicates the build logic from scripts.sh. It's not a big deal now because it's only a couple of standard lines, but if we want to customize the build in the future, it will be useful to have a single, authoritative build script that all build paths use.
- Loading branch information
Showing
2 changed files
with
26 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
# build frontend | ||
FROM node:22 as fe | ||
WORKDIR /src | ||
COPY .git frontend ./ | ||
RUN npm i && npm run build | ||
COPY .git .git/ | ||
COPY frontend ./frontend | ||
COPY scripts.sh . | ||
RUN ./scripts.sh build-frontend | ||
|
||
# build backend | ||
FROM golang:1.23 as be | ||
WORKDIR /src | ||
COPY . ./ | ||
COPY --from=fe /src/build ./frontend/build/ | ||
RUN go build -o fusion ./cmd/server/* | ||
COPY --from=fe /src/frontend/build ./frontend/build/ | ||
RUN ./scripts.sh build-backend | ||
|
||
# deploy | ||
FROM debian:12 | ||
LABEL org.opencontainers.image.source="https://github.com/0x2E/fusion" | ||
RUN apt-get update && apt-get install -y sqlite3 ca-certificates | ||
WORKDIR /fusion | ||
COPY --from=be /src/fusion ./ | ||
COPY --from=be /src/build/fusion ./ | ||
EXPOSE 8080 | ||
RUN mkdir /data | ||
ENV DB="/data/fusion.db" | ||
CMD [ "./fusion" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters