From a7d01012bcefddeabe873bbeca3c1219ce72cd06 Mon Sep 17 00:00:00 2001
From: Wolfgang Welz <welzwo@gmail.com>
Date: Thu, 4 Jul 2019 13:59:24 +0200
Subject: [PATCH] Add docker support

---
 .dockerignore |  2 ++
 Dockerfile    | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 .dockerignore
 create mode 100644 Dockerfile

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..f860d2cf
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+# Database directory
+mainnetdb/
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..6e89c387
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,35 @@
+# we need to use alpine to build since cgo is required
+FROM golang:1.12-alpine AS build
+RUN apk add --no-cache git gcc g++
+
+# Set the current Working Directory inside the container
+RUN mkdir /goshimmer
+WORKDIR /goshimmer
+
+# Download dependencies
+COPY go.mod . 
+COPY go.sum .
+RUN go mod download
+
+# Copy everything from the current directory to the PWD(Present Working Directory) inside the container
+COPY . .
+
+# Build
+RUN CGO_ENABLED=1 GOOS=linux go build -o /go/bin/goshimmer
+
+FROM alpine:latest  
+
+RUN apk --no-cache add ca-certificates
+
+WORKDIR /root/
+
+VOLUME /root/mainnetdb
+
+EXPOSE 14666/tcp
+EXPOSE 14626/udp
+EXPOSE 14626/tcp
+
+# Copy the Pre-built binary file from the previous stage
+COPY --from=build /go/bin/goshimmer .
+
+ENTRYPOINT ["./goshimmer"] 
-- 
GitLab