1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00

Use Makefile

This commit is contained in:
Maksym Pavlenko
2019-02-24 14:19:55 -08:00
parent f5764e3fe4
commit 30bfd2ebef
12 changed files with 53 additions and 33 deletions

2
.gitignore vendored
View File

@@ -24,7 +24,7 @@ _testmain.go
*.prof
.idea/
bin/
node_modules/
dist/
venv/

View File

@@ -1,13 +0,0 @@
FROM golang:1.11.2 AS backend_builder
WORKDIR /podsync
COPY . .
ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=0
RUN go build -o server -v ./cmd/app
FROM alpine
RUN apk --update --no-cache add ca-certificates
WORKDIR /app/
COPY --from=backend_builder /podsync/server .
ENTRYPOINT ["/app/server"]

23
Makefile Normal file
View File

@@ -0,0 +1,23 @@
SUBDIRS := cmd/app cmd/nginx cmd/ytdl
GOLANGCI := ./bin/golangci-lint
.PHONY: push
push:
for d in $(SUBDIRS); do $(MAKE) -C $$d push; done
$(GOLANGCI):
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b ./bin v1.15.0
./bin/golangci-lint --version
.PHONY: lint
lint: $(GOLANGCI)
./bin/golangci-lint run
.PHONY: test
test:
go test -short ./...
.PHONY: up
up:
docker-compose pull
docker-compose up -d

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env bash
docker build -t mxpv/podsync .
docker push mxpv/podsync

View File

@@ -8,12 +8,7 @@ env:
VIMEO_TEST_API_KEY: "/CodeBuild/vimeoKey"
phases:
install:
commands:
- go version
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b /usr/local/bin v1.12.5
- golangci-lint --version
build:
commands:
- go test -short ./...
- golangci-lint run
- make lint
- make test

1
cmd/app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
server

4
cmd/app/Dockerfile Normal file
View File

@@ -0,0 +1,4 @@
FROM alpine
RUN apk --update --no-cache add ca-certificates
COPY ./server /server
ENTRYPOINT ["/server"]

14
cmd/app/Makefile Normal file
View File

@@ -0,0 +1,14 @@
OUT := server
SRC := $(wildcard *.go)
build: $(SRC)
GOOS=linux go build -v -o $(OUT)
.PHONY: push
push: build
docker build -t mxpv/podsync .
docker push mxpv/podsync
.PHONY: clean
clean:
- rm -f $(OUT)

4
cmd/nginx/Makefile Normal file
View File

@@ -0,0 +1,4 @@
.PHONY: push
push:
docker build -t mxpv/nginx -f Dockerfile ../../
docker push mxpv/nginx

4
cmd/ytdl/Makefile Normal file
View File

@@ -0,0 +1,4 @@
.PHONY: push
push:
docker build -t mxpv/ytdl .
docker push mxpv/ytdl

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env bash
docker build -t mxpv/ytdl .
docker push mxpv/ytdl

View File

@@ -1,4 +0,0 @@
#!/usr/bin/env bash
docker build -t mxpv/nginx -f cmd/nginx/Dockerfile .
docker push mxpv/nginx