From 0919c6b832ae692cd38427f8bb76810bbe4737f0 Mon Sep 17 00:00:00 2001 From: Ambrose Chua Date: Mon, 24 May 2021 01:20:49 +0800 Subject: [PATCH] Fix Dockerfile, clean up *ignore --- .dockerignore | 7 +++++++ .github/workflows/build.yml | 2 +- .gitignore | 5 ++--- Dockerfile | 6 +++--- Makefile | 3 +++ 5 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8d93fcd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.git +.github + +upl + +web/node_modules +web/assets diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 037e81a..4e17221 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,7 +48,7 @@ jobs: uses: actions/checkout@v2 - name: Vet code - run: go vet ./... + run: make vet format: name: Format diff --git a/.gitignore b/.gitignore index 1e10cf9..a73ca4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -node_modules -web/assets upl -.env +web/node_modules +web/assets diff --git a/Dockerfile b/Dockerfile index 934e7f4..0392950 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ FROM golang:1.16-alpine3.13 as build RUN apk add \ make WORKDIR /src -COPY --from=build-web . . +COPY --from=build-web /src . ARG CGO_ENABLED=0 RUN make TAGS=production @@ -20,6 +20,6 @@ RUN make TAGS=production FROM scratch COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt -COPY --from=build upl /upl +COPY --from=build /src/upl /upl -RUN ["/upl"] +CMD ["/upl"] diff --git a/Makefile b/Makefile index 69aa3ad..e8f34be 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,9 @@ upl: *.go web/*.tmpl web .PHONY: test test: web $(GO) test -cover -bench=. -v ./... +.PHONY: vet +vet: web + $(GO) vet ./... .PHONY: web