mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
update build doc & dockerfiles
This commit is contained in:
parent
572e489db6
commit
a32361fab2
32
doc/build.md
32
doc/build.md
@ -1,21 +1,33 @@
|
|||||||
## Compilation
|
## Compilation
|
||||||
|
|
||||||
Install `Go >= 1.17` and `GCC`. Get the source code:
|
Prerequisies:
|
||||||
|
|
||||||
|
* Go >= 1.18
|
||||||
|
* C Compiler (GCC / Clang / ...)
|
||||||
|
* Zig >= 0.14.0 (optional, for cross-compiling CLI versions)
|
||||||
|
* binutils (optional, for building Windows GUI version)
|
||||||
|
|
||||||
|
Get the source code:
|
||||||
|
|
||||||
git clone https://github.com/nkanaev/yarr.git
|
git clone https://github.com/nkanaev/yarr.git
|
||||||
|
|
||||||
Then run one of the corresponding commands:
|
Compile:
|
||||||
|
|
||||||
# create an executable for the host os
|
# create cli for the host OS/architecture
|
||||||
make build_macos # -> _output/macos/yarr.app
|
make host # out/yarr
|
||||||
make build_linux # -> _output/linux/yarr
|
|
||||||
make build_windows # -> _output/windows/yarr.exe
|
|
||||||
|
|
||||||
# host-specific cli version (no gui)
|
# create GUI, works only in the target OS
|
||||||
make build_default # -> _output/yarr
|
make windows_amd64_gui # out/windows_amd64_gui/yarr.exe
|
||||||
|
make windows_arm64_gui # out/windows_arm64_gui/yarr.exe
|
||||||
|
make darwin_arm64_gui # out/darwin_arm64_gui/yarr.app
|
||||||
|
make darwin_amd64_gui # out/darwin_amd64_gui/yarr.app
|
||||||
|
|
||||||
# ... or start a dev server locally
|
# create cli, cross-compiles within any OS/architecture
|
||||||
make serve # starts a server at http://localhost:7070
|
make linux_amd64
|
||||||
|
make linux_arm64
|
||||||
|
make linux_armv7
|
||||||
|
make windows_amd64
|
||||||
|
make windows_arm64
|
||||||
|
|
||||||
# ... or build a docker image
|
# ... or build a docker image
|
||||||
docker build -t yarr -f etc/dockerfile .
|
docker build -t yarr -f etc/dockerfile .
|
||||||
|
@ -3,12 +3,12 @@ RUN apk add build-base git
|
|||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/pkg \
|
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/pkg \
|
||||||
make build_linux
|
make host
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk add --no-cache ca-certificates && \
|
RUN apk add --no-cache ca-certificates && \
|
||||||
update-ca-certificates
|
update-ca-certificates
|
||||||
COPY --from=build /src/_output/linux/yarr /usr/local/bin/yarr
|
COPY --from=build /src/out/yarr /usr/local/bin/yarr
|
||||||
EXPOSE 7070
|
EXPOSE 7070
|
||||||
ENTRYPOINT ["/usr/local/bin/yarr"]
|
ENTRYPOINT ["/usr/local/bin/yarr"]
|
||||||
CMD ["-addr", "0.0.0.0:7070", "-db", "/data/yarr.db"]
|
CMD ["-addr", "0.0.0.0:7070", "-db", "/data/yarr.db"]
|
||||||
|
@ -27,18 +27,12 @@ RUN env \
|
|||||||
CC=aarch64-linux-gnu-gcc \
|
CC=aarch64-linux-gnu-gcc \
|
||||||
CGO_ENABLED=1 \
|
CGO_ENABLED=1 \
|
||||||
GOOS=linux GOARCH=arm64 \
|
GOOS=linux GOARCH=arm64 \
|
||||||
go build \
|
make host && mv out/yarr /root/out/yarr.arm64
|
||||||
-tags "sqlite_foreign_keys linux" \
|
|
||||||
-ldflags="-s -w" \
|
|
||||||
-o /root/out/yarr.arm64 ./cmd/yarr
|
|
||||||
|
|
||||||
RUN env \
|
RUN env \
|
||||||
CC=arm-linux-gnueabihf-gcc \
|
CC=arm-linux-gnueabihf-gcc \
|
||||||
CGO_ENABLED=1 \
|
CGO_ENABLED=1 \
|
||||||
GOOS=linux GOARCH=arm GOARM=7 \
|
GOOS=linux GOARCH=arm GOARM=7 \
|
||||||
go build \
|
make host && mv out/yarr /root/out/yarr.armv7
|
||||||
-tags "sqlite_foreign_keys linux" \
|
|
||||||
-ldflags="-s -w" \
|
|
||||||
-o /root/out/yarr.arm7 ./cmd/yarr
|
|
||||||
|
|
||||||
CMD ["/bin/bash"]
|
CMD ["/bin/bash"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user