Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
fix docker, move to go modules
Browse files Browse the repository at this point in the history
  • Loading branch information
boramalper committed May 19, 2019
1 parent 1fdfa13 commit 5507ca3
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 107 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ vendor/
.idea/
Gopkg.lock
cmd/magneticow/bindata.go
go.sum


# Created by https://www.gitignore.io/api/go,linux,macos,windows
Expand Down
24 changes: 10 additions & 14 deletions Dockerfile.magneticod
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
# Source: https://blog.golang.org/docker

# Start from a Debian image with the latest version of Go installed
# 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

# Copy the local package files to the container's workspace.
ADD ./Gopkg.toml /go/src/github.com/boramalper/magnetico/
ADD ./Makefile /go/src/github.com/boramalper/magnetico/
ADD ./pkg /go/src/github.com/boramalper/magnetico/pkg
ADD ./cmd/magneticod /go/src/github.com/boramalper/magnetico/cmd/magneticod
ADD ./Makefile /magnetico/
ADD ./pkg /magnetico/pkg
ADD ./go.mod /magnetico/go.mod
ADD ./cmd/magneticod /magnetico/cmd/magneticod

# 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
WORKDIR /magnetico/
RUN make magneticod

FROM alpine:latest
LABEL maintainer="[email protected]"
WORKDIR /
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"]
34 changes: 19 additions & 15 deletions Dockerfile.magneticow
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
# Source: https://blog.golang.org/docker

# Start from a Debian image with the latest version of Go installed
# 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

# Copy the local package files to the container's workspace.
ADD ./Gopkg.toml /go/src/github.com/boramalper/magnetico/
ADD ./Makefile /go/src/github.com/boramalper/magnetico/
ADD ./pkg /go/src/github.com/boramalper/magnetico/pkg
ADD ./cmd/magneticow /go/src/github.com/boramalper/magnetico/cmd/magneticow

# 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
ADD ./Makefile /magnetico/
ADD ./pkg /magnetico/pkg
ADD ./go.mod /magnetico/go.mod
ADD ./cmd/magneticow /magnetico/cmd/magneticow

WORKDIR /magnetico

RUN go get -u github.com/kevinburke/go-bindata/...

RUN echo $PATH
RUN ls /go/bin

RUN make magneticow

FROM alpine:latest
LABEL maintainer="[email protected]"
WORKDIR /
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"]

# Document that the service listens on port 8080.
Expand Down
62 changes: 0 additions & 62 deletions Gopkg.toml

This file was deleted.

7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,11 +19,6 @@ image-magneticow:

image: image-magneticod image-magneticow

# Download dependencies
ensure:
dep ensure -v
go get -u github.com/kevinburke/go-bindata/...

vet:
go vet github.com/boramalper/magnetico/...

Expand Down
5 changes: 2 additions & 3 deletions cmd/magneticow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

## Installation

### Installing the Pre-Compiled Static Binary
You can find the latest pre-compiled static binaries on [GitHub](https://github.com/boramalper/magnetico/releases)
for versions from v0.7.0 onwards.

### Installing the Docker Image
Docker images are provided on [Docker Hub](https://hub.docker.com/r/boramalper/magnetico/tags/) at
the repository `boramalper/magnetico`. Images are tagged as `w-vMAJOR.MINOR.PATCH`.
Docker images are provided on [Docker Hub](https://hub.docker.com/u/boramalper) at
the repositories `boramalper/magneticod` and `boramalper/magneticow`.

## Setup
### Configuration
Expand Down
19 changes: 12 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
version: "2"
version: "3"

volumes:
shared_db:
home:

services:
magneticod:
build:
context: magneticod
context: .
dockerfile: Dockerfile.magneticod
volumes:
- shared_db:/root/.local/share
- home:/home/magnetico

magneticow:
build:
context: magneticow
context: .
dockerfile: Dockerfile.magneticow
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:
- "12345:8080"
- "8080:8080"
21 changes: 21 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)

0 comments on commit 5507ca3

Please sign in to comment.