Browse Source

add-deploy

pull/6/head
fedy95 4 years ago
parent
commit
03c043b9d2
  1. 42
      .drone.yml
  2. 8
      .editorconfig
  3. 8
      Dockerfile
  4. 24
      Makefile
  5. 5
      README.md
  6. 2
      deployments/docker-compose.yml
  7. 3
      go.mod

42
.drone.yml

@ -0,0 +1,42 @@
---
kind: pipeline
type: docker
name: pull_request
image_pull_secrets:
- dockerconfigjson
steps:
- name: lint yaml
image: registry.fedy95.com/baseimage-yamllint:latest
commands:
- yamllint -c /yamllint/relaxed.yaml deployments/docker-compose.yml
when:
event: pull_request
---
kind: pipeline
type: ssh
name: master_push
clone:
disable: true
server:
host:
from_secret: host
user:
from_secret: user
password:
from_secret: password
steps:
- name: release
commands:
- cd /home/fedy95/dev/news-aggregator-back
- git pull
- make restart
- name: cleanup
commands:
- cd /home/fedy95/dev/news-aggregator-back
- make cleanup
trigger:
branch:
- master
event:
- push
...

8
.editorconfig

@ -1,8 +1,10 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100

8
Dockerfile

@ -1,7 +1,7 @@
FROM golang:alpine as golang
FROM golang:1.16.4-alpine
COPY app /app
WORKDIR /app
ADD . /build
WORKDIR /build/app
RUN go build -o main .
CMD ["/app/main"]
CMD ["/build/app/main"]

24
Makefile

@ -1,15 +1,23 @@
MAKEFLAGS += --silent
.PHONY: *
build:
docker-compose --file deployments/docker-compose.yml --project-name news-aggregator-back build
REGISTRY=registry.fedy95.com
YAMLLINT_TAG=baseimage-yamllint:latest
lint: lint-yaml
start: build
LINT-YAML-CMD=docker run --rm -it -v $(PWD):/data ${REGISTRY}/${YAMLLINT_TAG}
lint-yaml:
docker pull ${REGISTRY}/${YAMLLINT_TAG}
$(LINT-YAML-CMD) deployments/docker-compose.yml
restart:
docker-compose --file deployments/docker-compose.yml --project-name news-aggregator-back build
docker-compose --file deployments/docker-compose.yml --project-name news-aggregator-back stop
docker-compose --file deployments/docker-compose.yml --project-name news-aggregator-back up -d
down:
docker-compose --file deployments/docker-compose.yml --project-name news-aggregator-back down
restart: down start
cleanup:
docker system prune --all --force
docker system prune --volumes --force
.DEFAULT_GOAL := restart
.DEFAULT_GOAL := lint

5
README.md

@ -1 +1,4 @@
# news-aggregator-back
### news-aggregator-back [![Build Status](https://drone.fedy95.com/api/badges/dev/news-aggregator-back/status.svg)](https://drone.fedy95.com/dev/news-aggregator-back)
---

2
deployments/docker-compose.yml

@ -1,3 +1,4 @@
---
version: "3.8"
services:
@ -10,3 +11,4 @@ services:
ports:
- "7070:7070"
...

3
go.mod

@ -0,0 +1,3 @@
module gitea.fedy95.com/dev/news-aggregator-back
go 1.16.4
Loading…
Cancel
Save