Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml

- name: Install Cairo dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev pkg-config

- name: Build
run: make build

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ jobs:
version: 9
run_install: false

- name: Build
- name: Install Cairo dependencies
run: |
sudo apt-get update
sudo apt-get install -y libcairo2-dev pkg-config

- name: Build
run: make all

- name: Release
Expand Down
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,25 @@ RUN pnpm install && pnpm build
FROM golang:bookworm AS gobuilder
ARG VERSION
WORKDIR /src

# Install Cairo development dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libcairo2-dev \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

COPY . .
COPY --from=uibuilder /src/dist ./ui/dist
#RUN apk add git
RUN go generate ./... && CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=${VERSION}" -o rmfakecloud-docker ./cmd/rmfakecloud/
RUN go generate ./... && CGO_ENABLED=1 go build -tags cairo -ldflags "-s -w -X main.version=${VERSION}" -o rmfakecloud-docker ./cmd/rmfakecloud/

FROM scratch
FROM debian:bookworm-slim
EXPOSE 3000
ADD ./docker/rootfs.tar /
COPY --from=gobuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=gobuilder /src/rmfakecloud-docker /
ENTRYPOINT ["/rmfakecloud-docker"]

# Install Cairo runtime libraries
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libcairo2 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=gobuilder /src/rmfakecloud-docker /rmfakecloud
ENTRYPOINT ["/rmfakecloud"]
9 changes: 8 additions & 1 deletion Dockerfile.make
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
FROM scratch
FROM debian:bookworm-slim
EXPOSE 3000

# Install Cairo runtime libraries
RUN apt-get update && apt-get install -y \
ca-certificates \
libcairo2 \
&& rm -rf /var/lib/apt/lists/*

#ENV RMAPI_HWR_HMAC
#ENV RM_SMTP_SERVER=""
#ENV RM_SMTP_USERNAME=""
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ LDFLAGS := "-s -w -X main.version=$(VERSION)"
OUT_DIR := dist
CMD := ./cmd/rmfakecloud
BINARY := rmfakecloud
BUILD = go build -ldflags $(LDFLAGS) -o $(@) $(CMD)
BUILD = CGO_ENABLED=1 go build -tags cairo -ldflags $(LDFLAGS) -o $(@) $(CMD)
ASSETS = ui/dist
GOFILES := $(shell find . -iname '*.go' ! -iname "*_test.go")
GOFILES += $(ASSETS)
Expand Down Expand Up @@ -35,13 +35,13 @@ $(OUT_DIR)/$(BINARY)-arm64:$(GOFILES)
GOARCH=arm64 $(BUILD)

$(OUT_DIR)/$(BINARY)-docker:$(GOFILES)
CGO_ENABLED=0 $(BUILD)
$(BUILD)

container: $(OUT_DIR)/$(BINARY)-docker
docker build -t rmfakecloud -f Dockerfile.make .

run: $(ASSETS)
go run $(CMD) $(ARG)
go run -tags cairo $(CMD) $(ARG)

$(ASSETS): $(UIFILES) ui/pnpm-lock.yaml
#@cp ui/node_modules/pdfjs-dist/build/pdf.worker.js ui/public/
Expand Down Expand Up @@ -70,5 +70,5 @@ testui:
#CI=true $(PNPM) test

testgo:
go test ./...
go test -tags cairo ./...

7 changes: 7 additions & 0 deletions docs/install/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ To be able to compile from source, you'll need the following dependencies:
* [pnpm](https://pnpm.io/)
* [go](https://go.dev/) version 1.16 at least
* make
* **Cairo graphics library** (required for PDF rendering with annotations)
- On Debian/Ubuntu: `sudo apt-get install libcairo2-dev pkg-config`
- On Fedora/RHEL: `sudo dnf install cairo-devel pkgconfig`
- On macOS: `brew install cairo pkg-config`
- On Arch Linux: `sudo pacman -S cairo pkgconf`

Build
-----
Expand All @@ -20,6 +25,8 @@ cd rmfakecloud
make all
```

**Note:** The build process requires Cairo to be installed, as it's used for rendering reMarkable annotations to PDF. The build uses the `-tags cairo` flag to enable Cairo support. If you encounter build errors related to Cairo, ensure the Cairo development libraries are properly installed on your system.

Installing
==========

Expand Down
35 changes: 15 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ddvk/rmfakecloud

go 1.23.3
go 1.24.0

toolchain go1.24.1

Expand All @@ -11,27 +11,24 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/juruen/rmapi v0.0.25
github.com/mochi-mqtt/server/v2 v2.7.9
github.com/pdfcpu/pdfcpu v0.11.1
github.com/poundifdef/go-remarkable2pdf v0.2.0
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/secsy/goftp v0.0.0-20200609142545-aa2de14babf4
github.com/sirupsen/logrus v1.9.3
github.com/soheilhy/cmux v0.1.5
github.com/stretchr/testify v1.9.0
github.com/studio-b12/gowebdav v0.9.0
github.com/unidoc/unipdf/v3 v3.56.0
golang.org/x/crypto v0.36.0
github.com/ungerik/go-cairo v0.0.0-20240304075741-47de8851d267
golang.org/x/crypto v0.43.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/adrg/strutil v0.3.1 // indirect
github.com/adrg/sysfont v0.1.2 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/bytedance/sonic v1.11.3 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/clipperhouse/uax29/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
Expand All @@ -40,32 +37,30 @@ require (
github.com/go-playground/validator/v10 v10.19.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/gorilla/i18n v0.0.0-20150820051429-8b358169da46 // indirect
github.com/hhrutter/lzw v1.0.0 // indirect
github.com/hhrutter/pkcs7 v0.2.0 // indirect
github.com/hhrutter/tiff v1.0.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jung-kurt/gofpdf v1.16.2 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.19 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/unidoc/freetype v0.2.3 // indirect
github.com/unidoc/pkcs7 v0.2.0 // indirect
github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a // indirect
github.com/unidoc/unichart v0.3.0 // indirect
github.com/unidoc/unitype v0.4.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/image v0.32.0 // indirect
golang.org/x/net v0.45.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/text v0.30.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading
Loading