From d678017aff201cf53a519c7caae7682e5b664153 Mon Sep 17 00:00:00 2001 From: fedy95 Date: Tue, 16 Feb 2021 21:35:11 +0300 Subject: [PATCH] init-repo --- .editorconfig | 8 ++++++++ Dockerfile | 7 +++++++ LICENSE | 19 ------------------- Makefile | 15 +++++++++++++++ app/main.go | 15 +++++++++++++++ docker-compose.yml | 12 ++++++++++++ 6 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 .editorconfig create mode 100644 Dockerfile delete mode 100644 LICENSE create mode 100644 Makefile create mode 100644 app/main.go create mode 100644 docker-compose.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..9141329 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d5a9060 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM golang:alpine as golang + +COPY ./app /app +WORKDIR /app + +RUN go build -o main . +CMD ["/app/main"] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 204b93d..0000000 --- a/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -MIT License Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS -OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b952292 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +MAKEFLAGS += --silent + +.PHONY: * + +build: + docker-compose -f docker-compose.yml build + +start: build + docker-compose -f docker-compose.yml up -d +down: + docker-compose -f docker-compose.yml down + +restart: down start + +.DEFAULT_GOAL := restart diff --git a/app/main.go b/app/main.go new file mode 100644 index 0000000..22feca4 --- /dev/null +++ b/app/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "fmt" + "log" + "net/http" +) + +func main() { + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Go app is worked!") + }) + + log.Fatal(http.ListenAndServe(":7070", nil)) +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e0482e9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: "3.8" + +services: + rss-aggregator: + build: + context: . + restart: always + container_name: rss-aggregator + hostname: rss-aggregator + + ports: + - "7070:7070"