From 8cf25e2ac9037ac26672ab0180a7c7bbbefddbda Mon Sep 17 00:00:00 2001 From: daskadse Date: Thu, 22 Jun 2023 09:12:43 +0000 Subject: [PATCH] added dockerfile and compose config (#1) Co-authored-by: Patrick Kauls Reviewed-on: https://git.dragse.it/fenpaws/e621-to-graph/pulls/1 --- .gitignore | 3 +++ Dockerfile | 22 ++++++++++++++++++++ docker-compose.yml => docker-compose.old.yml | 0 docker-compose.yaml | 8 +++++++ 4 files changed, 33 insertions(+) create mode 100644 Dockerfile rename docker-compose.yml => docker-compose.old.yml (100%) create mode 100644 docker-compose.yaml diff --git a/.gitignore b/.gitignore index d268bde..83411c1 100644 --- a/.gitignore +++ b/.gitignore @@ -189,3 +189,6 @@ $RECYCLE.BIN/ .idea/* /.run/* + + +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..495124d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM golang:alpine as builder + +WORKDIR /go/src/git.dragse.it/fenpaws/e621-to-neo4j + +RUN apk add -U --no-cache ca-certificates && update-ca-certificates + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . ./ +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags "-w -s" -o /app + + +FROM scratch + +WORKDIR / + +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /app ./ + +EXPOSE 8080 +CMD ["/app"] diff --git a/docker-compose.yml b/docker-compose.old.yml similarity index 100% rename from docker-compose.yml rename to docker-compose.old.yml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..c449062 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,8 @@ +services: + app: + restart: unless-stopped + build: . + ports: + - 8080:8080 + env_file: .env +