Browse Source

Add dockerfile.

This makes it easy to run irccat in docker. Instructions for use
are at the top of the dockerfile
tags/v0.3.4
Chris Smith 5 years ago
parent
commit
0603166269
1 changed files with 29 additions and 0 deletions
  1. 29
    0
      Dockerfile

+ 29
- 0
Dockerfile View File

@@ -0,0 +1,29 @@
1
+# This is a multi-part build that first statically builds irccat, and then
2
+# copies over the resulting binary and the default SSL root certs over into
3
+# a 'scratch' image, resulting in a very small image.
4
+#
5
+# You must provide a config file at /etc/irccat.[json|yaml|toml|hcl], for
6
+# example:
7
+#
8
+#  docker build . -t irccat
9
+#  docker run -d -P -v /path/to/my/config/irccat.json:/etc/irccat.json irccat
10
+#
11
+# (This will also expose the default ports: 12345 and 8045.)
12
+
13
+# Step one: fetch deps and build
14
+FROM golang:latest AS build
15
+
16
+ADD . /go/src/github.com/irccloud/irccat
17
+WORKDIR /go/src/github.com/irccloud/irccat
18
+
19
+RUN CGO_ENABLED=0 go get -t -v ./... && go build -a .
20
+
21
+# Step two: copy over the binary and root certs
22
+FROM scratch
23
+COPY --from=build /go/bin/irccat /irccat
24
+COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
25
+
26
+EXPOSE 12345
27
+EXPOSE 8045
28
+
29
+CMD ["/irccat"]

Loading…
Cancel
Save