From 4814945b2d818444e5a19126537b76af5dcb5c7a Mon Sep 17 00:00:00 2001 From: "Bora M. Alper" Date: Fri, 21 Feb 2020 11:39:35 +0000 Subject: [PATCH] fix docker --- .env | 3 +++ Dockerfile.magneticod | 3 --- Dockerfile.magneticow | 8 +------- docker-compose.yml | 7 ++++--- go.mod | 4 +++- magneticod_data/.gitignore | 2 ++ magneticow_conf/credentials | 1 + 7 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 .env create mode 100644 magneticod_data/.gitignore create mode 100644 magneticow_conf/credentials diff --git a/.env b/.env new file mode 100644 index 0000000..1f4f415 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +MAGNETICOD_DATA=./magneticod_data/ +MAGNETICOD_CONFIG=./magneticod_conf/ +MAGNETICOW_CONFIG=./magneticow_conf/ diff --git a/Dockerfile.magneticod b/Dockerfile.magneticod index 93c8922..1626e1d 100644 --- a/Dockerfile.magneticod +++ b/Dockerfile.magneticod @@ -1,11 +1,8 @@ -# Start from a Debian image with the latest version of Go installed -# and a workspace (GOPATH) configured at /go. FROM golang:1.13-alpine AS build WORKDIR /magnetico RUN apk add --no-cache build-base curl git -# Copy the local package files to the container's workspace. ADD ./Makefile /magnetico/ ADD ./pkg /magnetico/pkg ADD ./go.mod /magnetico/go.mod diff --git a/Dockerfile.magneticow b/Dockerfile.magneticow index 3e3d878..5ce7cb8 100644 --- a/Dockerfile.magneticow +++ b/Dockerfile.magneticow @@ -1,5 +1,3 @@ -# Start from a Debian image with the latest version of Go installed -# and a workspace (GOPATH) configured at /go. FROM golang:1.13-alpine AS build WORKDIR /magnetico @@ -7,7 +5,6 @@ RUN export PATH=$PATH:/go/bin RUN apk add --no-cache build-base curl git RUN go get -u github.com/kevinburke/go-bindata/... -# Copy the local package files to the container's workspace. ADD ./Makefile /magnetico/ ADD ./pkg /magnetico/pkg ADD ./go.mod /magnetico/go.mod @@ -17,13 +14,10 @@ RUN make magneticow FROM alpine:latest LABEL maintainer="bora@boramalper.org" -# the service listens on port 8080 EXPOSE 8080 WORKDIR / VOLUME /root/.local/share/magneticod - -RUN mkdir -p "/root/.config/magneticow/" -RUN echo 'magnetico:$2y$06$8VzJvXegA2X/tfmTXN7NM.FH5HRh8fbvXUmrtW52xLH5JNDhldexG' > "/root/.config/magneticow/credentials" +VOLUME /root/.config/magneticow COPY --from=build /go/bin/magneticow /magneticow diff --git a/docker-compose.yml b/docker-compose.yml index e07d907..4334549 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,14 +4,15 @@ services: magneticod: image: boramalper/magneticod volumes: - - magneticod-data:/root/.local/share/magneticod - - magneticod-config:/root/.config/magneticod + - ${MAGNETICOD_DATA}:/root/.local/share/magneticod + - ${MAGNETICOD_CONFIG}:/root/.config/magneticod network_mode: "host" magneticow: image: boramalper/magneticow volumes: - - magneticod-data:/root/.local/share/magneticod + - ${MAGNETICOD_DATA}:/root/.local/share/magneticod + - ${MAGNETICOW_CONFIG}:/root/.config/magneticod depends_on: # It doesn't necessarily "depend" on magneticod, but you would probably like to start them at the same time. - magneticod diff --git a/go.mod b/go.mod index b8d1f96..f384208 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/gorilla/schema v1.1.0 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 // indirect github.com/jessevdk/go-flags v1.4.0 - github.com/kevinburke/go-bindata v3.13.0+incompatible // indirect + github.com/kevinburke/go-bindata v3.16.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 @@ -23,3 +23,5 @@ require ( golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f golang.org/x/sys v0.0.0-20190516110030-61b9204099cb ) + +go 1.13 diff --git a/magneticod_data/.gitignore b/magneticod_data/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/magneticod_data/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/magneticow_conf/credentials b/magneticow_conf/credentials new file mode 100644 index 0000000..bb703e2 --- /dev/null +++ b/magneticow_conf/credentials @@ -0,0 +1 @@ +username:$2y$12$Hxazq0oQtowTVClMG2FPiujLF/6ZcM.YJxbWeJiTOdzFzzB4Sjun6