Skip to content

Commit

Permalink
change workdir for build and enforce vendoring from Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Sep 29, 2019
1 parent 5ebe8d0 commit c9fa409
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
FROM umputun/baseimage:buildgo-latest as build

WORKDIR /go/src/github.com/umputun/rss2twitter
ADD . /go/src/github.com/umputun/rss2twitter
WORKDIR /build/rss2twitter
ADD . /build/rss2twitter

# run tests
RUN cd app && go test ./...

# linters
RUN golangci-lint run --deadline=300s --out-format=tab --disable-all --tests=false --enable=interfacer --enable=unconvert \
--enable=megacheck --enable=structcheck --enable=gas --enable=gocyclo --enable=dupl --enable=misspell \
--enable=maligned --enable=unparam --enable=varcheck --enable=deadcode --enable=typecheck --enable=errcheck ./...
RUN cd app && go test -mod=vendor ./...

RUN \
version=$(/script/git-rev.sh) && \
echo "version=$version" && \
go build -o rss2twitter -ldflags "-X main.revision=${version} -s -w" ./app
go build -mod=vendor -o rss2twitter -ldflags "-X main.revision=${version} -s -w" ./app


FROM umputun/baseimage:app-latest

COPY --from=build /go/src/github.com/umputun/rss2twitter/rss2twitter /srv/rss2twitter
COPY --from=build /build/rss2twitter/rss2twitter /srv/rss2twitter
RUN \
chown -R app:app /srv && \
chmod +x /srv/rss2twitter
Expand Down

0 comments on commit c9fa409

Please sign in to comment.