mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
docker build instructions
This commit is contained in:
parent
e1a6ccf133
commit
a91f64ce9d
44
build.md
Normal file
44
build.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
## Compilation
|
||||||
|
|
||||||
|
Install `Go >= 1.16` and `GCC`. Get the source code:
|
||||||
|
|
||||||
|
git clone https://github.com/nkanaev/yarr.git
|
||||||
|
|
||||||
|
Then run one of the corresponding commands:
|
||||||
|
|
||||||
|
# create an executable for the host os
|
||||||
|
make build_macos # -> _output/macos/yarr.app
|
||||||
|
make build_linux # -> _output/linux/yarr
|
||||||
|
make build_windows # -> _output/windows/yarr.exe
|
||||||
|
|
||||||
|
# host-specific cli version (no gui)
|
||||||
|
make build_default # -> _output/yarr
|
||||||
|
|
||||||
|
# ... or start a dev server locally
|
||||||
|
make serve # starts a server at http://localhost:7070
|
||||||
|
|
||||||
|
# ... or build a docker image
|
||||||
|
docker build -t yarr .
|
||||||
|
|
||||||
|
## ARM compilation
|
||||||
|
|
||||||
|
The instructions below are to cross-compile *yarr* to `Linux/ARM*`.
|
||||||
|
|
||||||
|
Build:
|
||||||
|
|
||||||
|
docker build -t yarr.arm -f dockerfile.arm .
|
||||||
|
|
||||||
|
Test:
|
||||||
|
|
||||||
|
# inside host
|
||||||
|
docker run -it --rm yarr.arm
|
||||||
|
|
||||||
|
# then, inside container
|
||||||
|
cd /root/out
|
||||||
|
qemu-aarch64 -L /usr/aarch64-linux-gnu/ yarr.arm64
|
||||||
|
|
||||||
|
Extract files from images:
|
||||||
|
|
||||||
|
CID=$(docker create yarr.arm)
|
||||||
|
docker cp -a "$CID:/root/out" .
|
||||||
|
docker rm "$CID"
|
33
dockerfile.arm
Normal file
33
dockerfile.arm
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
FROM ubuntu:20.04
|
||||||
|
|
||||||
|
# Install GCC
|
||||||
|
RUN apt update
|
||||||
|
RUN apt install -y \
|
||||||
|
wget build-essential \
|
||||||
|
gcc-aarch64-linux-gnu \
|
||||||
|
binutils-aarch64-linux-gnu binutils-aarch64-linux-gnu-dbg
|
||||||
|
RUN env DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt install -y qemu-user qemu-user-static
|
||||||
|
|
||||||
|
# Install Golang
|
||||||
|
RUN wget --quiet https://go.dev/dl/go1.18.2.linux-amd64.tar.gz && \
|
||||||
|
rm -rf /usr/local/go && \
|
||||||
|
tar -C /usr/local -xzf go1.18.2.linux-amd64.tar.gz
|
||||||
|
ENV PATH=$PATH:/usr/local/go/bin
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
WORKDIR /root/src
|
||||||
|
RUN mkdir /root/out
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build ARM64
|
||||||
|
RUN env \
|
||||||
|
CC=aarch64-linux-gnu-gcc \
|
||||||
|
CGO_ENABLED=1 \
|
||||||
|
GOOS=linux GOARCH=arm64 \
|
||||||
|
go build \
|
||||||
|
-tags "sqlite_foreign_keys release linux" \
|
||||||
|
-ldflags="-s -w" \
|
||||||
|
-o /root/out/yarr.arm64 src/main.go
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
20
readme.md
20
readme.md
@ -45,25 +45,7 @@ and pasting the content:
|
|||||||
Categories=Internet;
|
Categories=Internet;
|
||||||
|
|
||||||
For self-hosting, see `yarr -h` for auth, tls & server configuration flags.
|
For self-hosting, see `yarr -h` for auth, tls & server configuration flags.
|
||||||
|
For building from source code, see [doc/build.md](doc/build.md)
|
||||||
## build
|
|
||||||
|
|
||||||
Install `Go >= 1.16` and `gcc`. Get the source code:
|
|
||||||
|
|
||||||
git clone https://github.com/nkanaev/yarr.git
|
|
||||||
|
|
||||||
Then run one of the corresponding commands:
|
|
||||||
|
|
||||||
# create an executable for the host os
|
|
||||||
make build_macos # -> _output/macos/yarr.app
|
|
||||||
make build_linux # -> _output/linux/yarr
|
|
||||||
make build_windows # -> _output/windows/yarr.exe
|
|
||||||
|
|
||||||
# ... or start a dev server locally
|
|
||||||
make serve # starts a server at http://localhost:7070
|
|
||||||
|
|
||||||
# ... or build a docker image
|
|
||||||
docker build -t yarr .
|
|
||||||
|
|
||||||
## credits
|
## credits
|
||||||
|
|
||||||
|
BIN
yarr.arm64
Executable file
BIN
yarr.arm64
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user