fix docker

This commit is contained in:
Bora M. Alper 2020-02-21 11:39:35 +00:00
parent c16276bf3f
commit 4814945b2d
No known key found for this signature in database
GPG Key ID: 8F1A9504E1BD114D
7 changed files with 14 additions and 14 deletions

3
.env Normal file
View File

@ -0,0 +1,3 @@
MAGNETICOD_DATA=./magneticod_data/
MAGNETICOD_CONFIG=./magneticod_conf/
MAGNETICOW_CONFIG=./magneticow_conf/

View File

@ -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 FROM golang:1.13-alpine AS build
WORKDIR /magnetico WORKDIR /magnetico
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.
ADD ./Makefile /magnetico/ ADD ./Makefile /magnetico/
ADD ./pkg /magnetico/pkg ADD ./pkg /magnetico/pkg
ADD ./go.mod /magnetico/go.mod ADD ./go.mod /magnetico/go.mod

View File

@ -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 FROM golang:1.13-alpine AS build
WORKDIR /magnetico WORKDIR /magnetico
@ -7,7 +5,6 @@ RUN export PATH=$PATH:/go/bin
RUN apk add --no-cache build-base curl git RUN apk add --no-cache build-base curl git
RUN go get -u github.com/kevinburke/go-bindata/... RUN go get -u github.com/kevinburke/go-bindata/...
# Copy the local package files to the container's workspace.
ADD ./Makefile /magnetico/ ADD ./Makefile /magnetico/
ADD ./pkg /magnetico/pkg ADD ./pkg /magnetico/pkg
ADD ./go.mod /magnetico/go.mod ADD ./go.mod /magnetico/go.mod
@ -17,13 +14,10 @@ RUN make magneticow
FROM alpine:latest FROM alpine:latest
LABEL maintainer="bora@boramalper.org" LABEL maintainer="bora@boramalper.org"
# the service listens on port 8080
EXPOSE 8080 EXPOSE 8080
WORKDIR / WORKDIR /
VOLUME /root/.local/share/magneticod VOLUME /root/.local/share/magneticod
VOLUME /root/.config/magneticow
RUN mkdir -p "/root/.config/magneticow/"
RUN echo 'magnetico:$2y$06$8VzJvXegA2X/tfmTXN7NM.FH5HRh8fbvXUmrtW52xLH5JNDhldexG' > "/root/.config/magneticow/credentials"
COPY --from=build /go/bin/magneticow /magneticow COPY --from=build /go/bin/magneticow /magneticow

View File

@ -4,14 +4,15 @@ services:
magneticod: magneticod:
image: boramalper/magneticod image: boramalper/magneticod
volumes: volumes:
- magneticod-data:/root/.local/share/magneticod - ${MAGNETICOD_DATA}:/root/.local/share/magneticod
- magneticod-config:/root/.config/magneticod - ${MAGNETICOD_CONFIG}:/root/.config/magneticod
network_mode: "host" network_mode: "host"
magneticow: magneticow:
image: boramalper/magneticow image: boramalper/magneticow
volumes: volumes:
- magneticod-data:/root/.local/share/magneticod - ${MAGNETICOD_DATA}:/root/.local/share/magneticod
- ${MAGNETICOW_CONFIG}:/root/.config/magneticod
depends_on: depends_on:
# It doesn't necessarily "depend" on magneticod, but you would probably like to start them at the same time. # It doesn't necessarily "depend" on magneticod, but you would probably like to start them at the same time.
- magneticod - magneticod

4
go.mod
View File

@ -11,7 +11,7 @@ require (
github.com/gorilla/schema v1.1.0 github.com/gorilla/schema v1.1.0
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 // indirect github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 // indirect
github.com/jessevdk/go-flags v1.4.0 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/libp2p/go-sockaddr v0.0.1
github.com/mattn/go-sqlite3 v1.10.0 github.com/mattn/go-sqlite3 v1.10.0
github.com/pkg/errors v0.8.1 github.com/pkg/errors v0.8.1
@ -23,3 +23,5 @@ require (
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f
golang.org/x/sys v0.0.0-20190516110030-61b9204099cb golang.org/x/sys v0.0.0-20190516110030-61b9204099cb
) )
go 1.13

2
magneticod_data/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -0,0 +1 @@
username:$2y$12$Hxazq0oQtowTVClMG2FPiujLF/6ZcM.YJxbWeJiTOdzFzzB4Sjun6