aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-12 23:39:29 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-12 23:39:29 +0200
commitc755b89265898af30b88642494c7311a4a3f3513 (patch)
tree7fdb8967e29ce5279fb2969274a37e18d37cd02f
parentaebada08bc95a7175138ee3ed2923741966410a0 (diff)
downloadfeed2imap-go-c755b89265898af30b88642494c7311a4a3f3513.tar.gz
feed2imap-go-c755b89265898af30b88642494c7311a4a3f3513.tar.bz2
feed2imap-go-c755b89265898af30b88642494c7311a4a3f3513.zip
Docker Setup
Diffstat (limited to '')
-rw-r--r--.goreleaser.yml35
-rw-r--r--Dockerfile11
-rw-r--r--README.md20
-rw-r--r--docker-compose.yml13
4 files changed, 48 insertions, 31 deletions
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 4b328af..63ae887 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -4,7 +4,8 @@ before:
hooks:
- go mod download
builds:
- -
+ -
+ id: standalone
binary: feed2imap-go
ldflags:
- -s -w -X github.com/Necoro/feed2imap-go/pkg/version.version={{.Version}} -X github.com/Necoro/feed2imap-go/pkg/version.commit={{.ShortCommit}}
@@ -14,8 +15,40 @@ builds:
- darwin
goarch:
- amd64
+
+ # for DOCKER we explicitly disable CGO
+ # we keep it enabled for the standalone version, b/c it might have advantages on
+ # more complicated setups, where the go internal implementations call out to glibc
+ -
+ id: docker
+ binary: feed2imap-go
+ env:
+ - CGO_ENABLED=0
+ ldflags:
+ - -s -w -X github.com/Necoro/feed2imap-go/pkg/version.version={{.Version}} -X github.com/Necoro/feed2imap-go/pkg/version.commit={{.ShortCommit}}
+ goos:
+ - linux
+ goarch:
+ - amd64
+
+dockers:
+ -
+ builds:
+ - docker
+ goos: linux
+ goarch: amd64
+ binaries:
+ - feed2imap-go
+ image_templates:
+ - "feed2imap-go:latest"
+ - "feed2imap-go:{{ .Version }}"
+ - "docker.pkg.github.com/necoro/feed2imap-go/feed2imap-go:latest"
+ - "docker.pkg.github.com/necoro/feed2imap-go/feed2imap-go:{{ .Version }}"
+
archives:
-
+ builds:
+ - standalone
replacements:
amd64: x86_64
386: x86_32
diff --git a/Dockerfile b/Dockerfile
index cd221bd..1d26d4e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,9 +1,6 @@
-FROM golang:alpine
+FROM alpine
-RUN mkdir /app
-WORKDIR /app
-COPY dist/feed2imap-go_linux_amd64/feed2imap-go /app/feed2imap-go
-COPY config.yml /app/config.yml
-
-ENTRYPOINT ["/app/feed2imap-go", "-c", "/app/data/feed.cache", "-f", "/app/config.yml" ]
+COPY feed2imap-go /
+ENTRYPOINT ["/feed2imap-go"]
+CMD ["-c", "/data/feed.cache", "-f", "/data/config.yml"]
diff --git a/README.md b/README.md
index f6c3186..60ea6ac 100644
--- a/README.md
+++ b/README.md
@@ -92,24 +92,24 @@ and b) the update process is not clear, especially regarding the dependencies.
### Run in docker
-Build docker image:
+Most times, putting feed2imap-go somewhere and adding a cron job does everything you need. For the times, where it isn't we provide docker containers for your convenience at [Github Packages](https://github.com/Necoro/feed2imap-go/packages).
+The container is configured to expect both config file and cache under `/data/`, thus needs it mounted there.
+When both are stored in `~/feed`, you can do:
````bash
-docker build -t feed2imap-go .
+docker run -v ~/feed:/data docker.pkg.github.com/necoro/feed2imap-go/feed2imap-go:latest
````
-Run docker-command:
-
+Alternatively, build the docker image yourself (requires the `feed2imap-go` binary at toplevel):
````bash
-docker volume create docker_feeddata
-docker container run -v feeddata:/app/data feed2imap-go
+docker build -t feed2imap-go .
````
+Note that the supplied binary must not be linked to glibc, i.e. has to be built with `CGO_ENABLED=0`. When using `goreleaser`, you'll find this in `dist/docker_linux_amd64`.
-Or run with docker-compose:
+Or you can roll your own Dockerfile, supplying a glibc...
+
+**NB**: feed2imap-go employs no server-mode. Thus, each run terminates directly after a couple seconds. Therefore, the docker container in itself is not that useful and you have to have a mechanism in place to spin up the container regularly.
-````bash
-docker-compose up
-````
[i6]: https://github.com/Necoro/feed2imap-go/issues/6
[i4]: https://github.com/Necoro/feed2imap-go/issues/4
diff --git a/docker-compose.yml b/docker-compose.yml
deleted file mode 100644
index d27aa2a..0000000
--- a/docker-compose.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-version: "2"
-
-services:
-
- feed2imap:
- image: "feed2imap-go"
- volumes:
- - "feeddata:/app/data"
-
-volumes:
- feeddata:
-
-