remove docker

This commit is contained in:
Michele Guerini Rocco 2024-07-25 14:23:49 +02:00
parent 06d864d49f
commit 57919f27b5
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
5 changed files with 19 additions and 119 deletions

View File

@ -1,22 +0,0 @@
FROM golang:1.19-alpine AS build
WORKDIR /magnetico
RUN apk add --no-cache build-base curl git
ADD ./Makefile /magnetico/
ADD ./pkg /magnetico/pkg
ADD ./go.mod /magnetico/go.mod
ADD ./go.sum /magnetico/go.sum
ADD ./cmd/magneticod /magnetico/cmd/magneticod
RUN make magneticod
FROM alpine:latest
LABEL maintainer="bora@boramalper.org"
WORKDIR /
VOLUME /root/.local/share/magneticod
VOLUME /root/.config/magneticod
COPY --from=build /go/bin/magneticod /magneticod
ENTRYPOINT ["/magneticod"]

View File

@ -1,26 +0,0 @@
FROM golang:1.19-alpine AS build
WORKDIR /magnetico
RUN export PATH=$PATH:/go/bin
RUN apk add --no-cache build-base curl git
ADD ./Makefile /magnetico/
ADD ./pkg /magnetico/pkg
ADD ./go.mod /magnetico/go.mod
ADD ./go.sum /magnetico/go.sum
ADD ./cmd/magneticow /magnetico/cmd/magneticow
RUN make magneticow
FROM alpine:latest
LABEL maintainer="bora@boramalper.org"
EXPOSE 8080
WORKDIR /
VOLUME /root/.local/share/magneticod
VOLUME /root/.config/magneticow
RUN apk add --no-cache libgcc libstdc++
COPY --from=build /go/bin/magneticow /magneticow
ENTRYPOINT ["/magneticow"]

View File

@ -1,43 +1,29 @@
.PHONY: test format vet staticcheck magneticod magneticow image image-magneticow image-magneticod PREFIX ?= /usr/local
GOFLAGS = -tags='fts5,libsqlite3' -ldflags="-s -w -X main.compiledOn=$(SOURCE_DATE_EPOCH)"
all: test magneticod magneticow .PHONY: all
all: bin/magneticod bin/magneticow
magneticod: bin/magneticod:
go install --tags fts5 --tags libsqlite3 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticod go install $(GOFLAGS) ./cmd/magneticod
magneticow: bin/magneticow:
# TODO: minify /data/* files! # TODO: minify /data/* files!
go install --tags fts5 --tags libsqlite3 "-ldflags=-s -w -X main.compiledOn=`date -u +%Y-%m-%dT%H:%M:%SZ`" ./cmd/magneticow go install $(GOFLAGS) ./cmd/magneticow
.PHONY: docker
docker: docker_up docker_logs
.PHONY: docker_up
docker_up:
docker-compose up -d
.PHONY: docker_down
docker_down:
docker-compose down
.PHONY: docker_logs
docker_logs:
docker-compose logs -ft --tail=10
image-magneticod:
docker build -t boramalper/magneticod -f Dockerfile.magneticod .
image-magneticow:
docker build -t boramalper/magneticow -f Dockerfile.magneticow .
image: image-magneticod image-magneticow
.PHONY: vet
vet: vet:
go vet ./... go vet ./...
test: .PHONY: check
go test --tags libsqlite3 ./... check:
go test $(GOFLAGS) ./...
.PHONY: install
install: bin/magneticod bin/magneticow
install -m 555 -Dt "$(PREFIX)/bin/" bin/magnetico{w,d}
.PHONY: format
format: format:
gofmt -w ./cmd/ gofmt -w ./cmd/
gofmt -w ./pkg/ gofmt -w ./pkg/
@ -64,6 +50,7 @@ format:
# gofmt -l $(go list -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' ./... | grep -v bindata.go) # gofmt -l $(go list -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' ./... | grep -v bindata.go)
# #
# The original query is then escaped for Makefile (by repeating dollar signs $ -> $$). # The original query is then escaped for Makefile (by repeating dollar signs $ -> $$).
.PHONY: check-formatting
check-formatting: SHELL:=/bin/bash # HERE: this is setting the shell for check-formatting only check-formatting: SHELL:=/bin/bash # HERE: this is setting the shell for check-formatting only
check-formatting: check-formatting:
! gofmt -l $$(go list -f $$'{{range .GoFiles}}{{$$.Dir}}/{{.}}\n{{end}}' ./... | grep -v bindata.go) 2>&1 | tee /dev/fd/2 | read ! gofmt -l $$(go list -f $$'{{range .GoFiles}}{{$$.Dir}}/{{.}}\n{{end}}' ./... | grep -v bindata.go) 2>&1 | tee /dev/fd/2 | read

View File

@ -26,7 +26,7 @@ central entity*.
## Features ## Features
- Easy installation & minimal requirements: - Easy installation & minimal requirements:
- [Pre-compiled static binaries](https://github.com/boramalper/magnetico/releases) and [Docker images](https://hub.docker.com/u/boramalper) are provided. - [Pre-compiled static binaries](https://github.com/boramalper/magnetico/releases)
- Root access is *not* required to install or to use. - Root access is *not* required to install or to use.
- Near-zero configuration: - Near-zero configuration:
- Both programs work out of the box, and **magneticow** can be used without a web-server too. - Both programs work out of the box, and **magneticow** can be used without a web-server too.
@ -79,26 +79,6 @@ for torrents in the network, hence removing the need for centralised torrent web
2. Install **magneticow** afterwards by following its 2. Install **magneticow** afterwards by following its
[installation instructions](cmd/magneticow/README.md). [installation instructions](cmd/magneticow/README.md).
### Docker
Run **magneticod** and **magneticow** with:
``` bash
make docker
```
It will run magnetico from already built image on [Docker Hub](https://hub.docker.com/u/boramalper)!
You should access magneticow at <http://localhost:8080>.
To build fresh images from source, first run:
``` bash
make image
```
Then run `make docker`. It ensures you run updated images of magnetico.
## License ## License
All the code is licensed under AGPLv3, unless stated otherwise specifically. See `COPYING` for All the code is licensed under AGPLv3, unless stated otherwise specifically. See `COPYING` for

View File

@ -1,19 +0,0 @@
version: "2"
services:
magneticod:
image: boramalper/magneticod:latest
volumes:
- ${MAGNETICOD_DATA}:/root/.local/share/magneticod
- ${MAGNETICOD_CONFIG}:/root/.config/magneticod
network_mode: "host"
command:
- "--indexer-addr=0.0.0.0:1212"
magneticow:
image: boramalper/magneticow:latest
volumes:
- ${MAGNETICOD_DATA}:/root/.local/share/magneticod
- ${MAGNETICOW_CONFIG}:/root/.config/magneticow
ports:
- "8080:8080"