aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Containerfile15
-rw-r--r--container-compose.yml27
3 files changed, 43 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index b923b6d..f3948d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.newsstandrc.toml
+newsstand
diff --git a/Containerfile b/Containerfile
new file mode 100644
index 0000000..4c34116
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,15 @@
+FROM golang:alpine
+
+WORKDIR /opt/build
+
+COPY go.mod go.sum ./
+
+RUN go mod download
+
+COPY . .
+
+RUN CGO_ENABLED=0 GOOS=linux go build -o /opt/newsstand src/main.go
+
+EXPOSE 8080
+
+CMD ["/opt/newsstand"]
diff --git a/container-compose.yml b/container-compose.yml
new file mode 100644
index 0000000..a471d8b
--- /dev/null
+++ b/container-compose.yml
@@ -0,0 +1,27 @@
+version: "3.8"
+services:
+ server:
+ build:
+ containerfile: Containerfile
+ context: .
+ depends_on:
+ - database
+ networks:
+ - default
+ ports:
+ - "8080:8080"
+ networks:
+ - backend
+ database:
+ image: postgres:latest
+ restart: always
+ ports:
+ - "9002:5432"
+ volumes:
+ - data:/var/lib/postgresql/data
+ networks:
+ - backend
+volumes:
+ data:
+networks:
+ backend: