fix docker, move to go modules
This commit is contained in:
parent
1fdfa131aa
commit
5507ca371a
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ vendor/
|
|||||||
.idea/
|
.idea/
|
||||||
Gopkg.lock
|
Gopkg.lock
|
||||||
cmd/magneticow/bindata.go
|
cmd/magneticow/bindata.go
|
||||||
|
go.sum
|
||||||
|
|
||||||
|
|
||||||
# Created by https://www.gitignore.io/api/go,linux,macos,windows
|
# Created by https://www.gitignore.io/api/go,linux,macos,windows
|
||||||
|
@ -1,28 +1,24 @@
|
|||||||
# Source: https://blog.golang.org/docker
|
|
||||||
|
|
||||||
# Start from a Debian image with the latest version of Go installed
|
# Start from a Debian image with the latest version of Go installed
|
||||||
# and a workspace (GOPATH) configured at /go.
|
# and a workspace (GOPATH) configured at /go.
|
||||||
FROM golang:1.11-alpine AS build
|
FROM golang:1.12-alpine AS build
|
||||||
|
|
||||||
RUN apk add --no-cache build-base curl git
|
RUN apk add --no-cache build-base curl git
|
||||||
|
|
||||||
# Copy the local package files to the container's workspace.
|
# Copy the local package files to the container's workspace.
|
||||||
ADD ./Gopkg.toml /go/src/github.com/boramalper/magnetico/
|
ADD ./Makefile /magnetico/
|
||||||
ADD ./Makefile /go/src/github.com/boramalper/magnetico/
|
ADD ./pkg /magnetico/pkg
|
||||||
ADD ./pkg /go/src/github.com/boramalper/magnetico/pkg
|
ADD ./go.mod /magnetico/go.mod
|
||||||
ADD ./cmd/magneticod /go/src/github.com/boramalper/magnetico/cmd/magneticod
|
ADD ./cmd/magneticod /magnetico/cmd/magneticod
|
||||||
|
|
||||||
# Build the outyet command inside the container.
|
WORKDIR /magnetico/
|
||||||
# (You may fetch or manage dependencies here,
|
|
||||||
# either manually or with a tool like "godep".)
|
|
||||||
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
|
||||||
WORKDIR /go/src/github.com/boramalper/magnetico/
|
|
||||||
RUN make ensure
|
|
||||||
RUN make magneticod
|
RUN make magneticod
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
LABEL maintainer="bora@boramalper.org"
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=build /go/bin/magneticod /magneticod
|
COPY --from=build /go/bin/magneticod /magneticod
|
||||||
|
|
||||||
# Run the outyet command by default when the container starts.
|
RUN adduser -D -S magnetico
|
||||||
|
USER magnetico
|
||||||
|
|
||||||
ENTRYPOINT ["/magneticod"]
|
ENTRYPOINT ["/magneticod"]
|
||||||
|
@ -1,30 +1,34 @@
|
|||||||
# Source: https://blog.golang.org/docker
|
|
||||||
|
|
||||||
# Start from a Debian image with the latest version of Go installed
|
# Start from a Debian image with the latest version of Go installed
|
||||||
# and a workspace (GOPATH) configured at /go.
|
# and a workspace (GOPATH) configured at /go.
|
||||||
FROM golang:1.11-alpine AS build
|
FROM golang:1.12-alpine AS build
|
||||||
|
|
||||||
|
RUN export PATH=$PATH:/go/bin
|
||||||
|
|
||||||
RUN apk add --no-cache build-base curl git
|
RUN apk add --no-cache build-base curl git
|
||||||
|
|
||||||
# Copy the local package files to the container's workspace.
|
# Copy the local package files to the container's workspace.
|
||||||
ADD ./Gopkg.toml /go/src/github.com/boramalper/magnetico/
|
ADD ./Makefile /magnetico/
|
||||||
ADD ./Makefile /go/src/github.com/boramalper/magnetico/
|
ADD ./pkg /magnetico/pkg
|
||||||
ADD ./pkg /go/src/github.com/boramalper/magnetico/pkg
|
ADD ./go.mod /magnetico/go.mod
|
||||||
ADD ./cmd/magneticow /go/src/github.com/boramalper/magnetico/cmd/magneticow
|
ADD ./cmd/magneticow /magnetico/cmd/magneticow
|
||||||
|
|
||||||
|
WORKDIR /magnetico
|
||||||
|
|
||||||
|
RUN go get -u github.com/kevinburke/go-bindata/...
|
||||||
|
|
||||||
|
RUN echo $PATH
|
||||||
|
RUN ls /go/bin
|
||||||
|
|
||||||
# Build the outyet command inside the container.
|
|
||||||
# (You may fetch or manage dependencies here,
|
|
||||||
# either manually or with a tool like "godep".)
|
|
||||||
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
|
||||||
WORKDIR /go/src/github.com/boramalper/magnetico/
|
|
||||||
RUN make ensure
|
|
||||||
RUN make magneticow
|
RUN make magneticow
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
LABEL maintainer="bora@boramalper.org"
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
COPY --from=build /go/bin/magneticow /magneticow
|
COPY --from=build /go/bin/magneticow /magneticow
|
||||||
|
|
||||||
# Run the outyet command by default when the container starts.
|
RUN adduser -D -S magnetico
|
||||||
|
USER magnetico
|
||||||
|
|
||||||
ENTRYPOINT ["/magneticow"]
|
ENTRYPOINT ["/magneticow"]
|
||||||
|
|
||||||
# Document that the service listens on port 8080.
|
# Document that the service listens on port 8080.
|
||||||
|
62
Gopkg.toml
62
Gopkg.toml
@ -1,62 +0,0 @@
|
|||||||
|
|
||||||
# Gopkg.toml example
|
|
||||||
#
|
|
||||||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
|
||||||
# for detailed Gopkg.toml documentation.
|
|
||||||
#
|
|
||||||
# required = ["github.com/user/thing/cmd/thing"]
|
|
||||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
|
||||||
#
|
|
||||||
# [[constraint]]
|
|
||||||
# name = "github.com/user/project"
|
|
||||||
# version = "1.0.0"
|
|
||||||
#
|
|
||||||
# [[constraint]]
|
|
||||||
# name = "github.com/user/project2"
|
|
||||||
# branch = "dev"
|
|
||||||
# source = "github.com/myfork/project2"
|
|
||||||
#
|
|
||||||
# [[override]]
|
|
||||||
# name = "github.com/x/y"
|
|
||||||
# version = "2.4.0"
|
|
||||||
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/Wessie/appdirs"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/anacrolix/missinggo"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/anacrolix/torrent"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "github.com/dustin/go-humanize"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/gorilla/mux"
|
|
||||||
version = "1.5.0"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/jessevdk/go-flags"
|
|
||||||
version = "1.3.0"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/mattn/go-sqlite3"
|
|
||||||
version = "1.3.0"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/willf/bloom"
|
|
||||||
version = "2.0.3"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "go.uber.org/zap"
|
|
||||||
version = "1.7.1"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
name = "github.com/libp2p/go-sockaddr"
|
|
||||||
version = "1.0.3"
|
|
7
Makefile
7
Makefile
@ -1,4 +1,4 @@
|
|||||||
.PHONY: test format vet staticcheck magneticod magneticow ensure image image-magneticow image-magneticod
|
.PHONY: test format vet staticcheck magneticod magneticow image image-magneticow image-magneticod
|
||||||
|
|
||||||
all: test magneticod magneticow
|
all: test magneticod magneticow
|
||||||
|
|
||||||
@ -19,11 +19,6 @@ image-magneticow:
|
|||||||
|
|
||||||
image: image-magneticod image-magneticow
|
image: image-magneticod image-magneticow
|
||||||
|
|
||||||
# Download dependencies
|
|
||||||
ensure:
|
|
||||||
dep ensure -v
|
|
||||||
go get -u github.com/kevinburke/go-bindata/...
|
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
go vet github.com/boramalper/magnetico/...
|
go vet github.com/boramalper/magnetico/...
|
||||||
|
|
||||||
|
@ -8,14 +8,13 @@ See the list of [alternative front-ends](https://github.com/boramalper/magnetico
|
|||||||
developed by the community if you need something more advanced or different.
|
developed by the community if you need something more advanced or different.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Installing the Pre-Compiled Static Binary
|
### Installing the Pre-Compiled Static Binary
|
||||||
You can find the latest pre-compiled static binaries on [GitHub](https://github.com/boramalper/magnetico/releases)
|
You can find the latest pre-compiled static binaries on [GitHub](https://github.com/boramalper/magnetico/releases)
|
||||||
for versions from v0.7.0 onwards.
|
for versions from v0.7.0 onwards.
|
||||||
|
|
||||||
### Installing the Docker Image
|
### Installing the Docker Image
|
||||||
Docker images are provided on [Docker Hub](https://hub.docker.com/r/boramalper/magnetico/tags/) at
|
Docker images are provided on [Docker Hub](https://hub.docker.com/u/boramalper) at
|
||||||
the repository `boramalper/magnetico`. Images are tagged as `w-vMAJOR.MINOR.PATCH`.
|
the repositories `boramalper/magneticod` and `boramalper/magneticow`.
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
### Configuration
|
### Configuration
|
||||||
|
@ -1,20 +1,25 @@
|
|||||||
version: "2"
|
version: "3"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
shared_db:
|
home:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
magneticod:
|
magneticod:
|
||||||
build:
|
build:
|
||||||
context: magneticod
|
context: .
|
||||||
|
dockerfile: Dockerfile.magneticod
|
||||||
volumes:
|
volumes:
|
||||||
- shared_db:/root/.local/share
|
- home:/home/magnetico
|
||||||
|
|
||||||
magneticow:
|
magneticow:
|
||||||
build:
|
build:
|
||||||
context: magneticow
|
context: .
|
||||||
|
dockerfile: Dockerfile.magneticow
|
||||||
volumes:
|
volumes:
|
||||||
- shared_db:/root/.local/share
|
- home:/home/magnetico
|
||||||
|
depends_on:
|
||||||
|
# It doesn't necessarily "depend" on magneticod, but you would probably like to start them at the same time.
|
||||||
|
- magneticod
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- "12345:8080"
|
- "8080:8080"
|
||||||
|
21
go.mod
Normal file
21
go.mod
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
module github.com/boramalper/magnetico
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/Wessie/appdirs v0.0.0-20141031215813-6573e894f8e2
|
||||||
|
github.com/anacrolix/missinggo v1.1.0
|
||||||
|
github.com/anacrolix/torrent v1.1.4
|
||||||
|
github.com/dustin/go-humanize v1.0.0
|
||||||
|
github.com/gorilla/mux v1.7.2
|
||||||
|
github.com/gorilla/schema v1.1.0
|
||||||
|
github.com/jessevdk/go-flags v1.4.0
|
||||||
|
github.com/kevinburke/go-bindata v3.13.0+incompatible // indirect
|
||||||
|
github.com/libp2p/go-sockaddr v0.0.1
|
||||||
|
github.com/mattn/go-sqlite3 v1.10.0
|
||||||
|
github.com/pkg/errors v0.8.1
|
||||||
|
github.com/willf/bloom v2.0.3+incompatible
|
||||||
|
go.uber.org/atomic v1.4.0 // indirect
|
||||||
|
go.uber.org/multierr v1.1.0 // indirect
|
||||||
|
go.uber.org/zap v1.10.0
|
||||||
|
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f
|
||||||
|
golang.org/x/sys v0.0.0-20190516110030-61b9204099cb
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user