adjust dockerfile to support go test with -race, bump images

This commit is contained in:
Dmitry Verkhoturov
2020-10-07 19:32:39 -05:00
committed by Umputun
parent a1fcef670e
commit 593ca0387f
2 changed files with 9 additions and 8 deletions
+6 -3
View File
@@ -1,4 +1,4 @@
FROM umputun/baseimage:buildgo-v1.4.1 as build-backend
FROM umputun/baseimage:buildgo-v1.6.1 as build-backend
ARG CI
ARG DRONE
@@ -16,11 +16,14 @@ WORKDIR /build/backend
ENV GOFLAGS="-mod=vendor"
# install gcc in order to be able to go test package with -race
RUN apk --no-cache add gcc libc-dev
# run tests
RUN \
cd app && \
if [ -z "$SKIP_BACKEND_TEST" ] ; then \
go test -race -p 1 -timeout="${BACKEND_TEST_TIMEOUT:-300s}" -covermode=atomic -coverprofile=/profile.cov_tmp ./... && \
CGO_ENABLED=1 go test -race -p 1 -timeout="${BACKEND_TEST_TIMEOUT:-300s}" -covermode=atomic -coverprofile=/profile.cov_tmp ./... && \
cat /profile.cov_tmp | grep -v "_mock.go" > /profile.cov ; \
golangci-lint run --config ../.golangci.yml ./... ; \
else echo "skip backend tests and linter" ; fi
@@ -57,7 +60,7 @@ RUN cd /srv/frontend && \
else echo "skip frontend tests and lint" ; npm run build ; fi && \
rm -rf ./node_modules
FROM umputun/baseimage:app-v1.4.1
FROM umputun/baseimage:app-v1.6.1
WORKDIR /srv
+3 -5
View File
@@ -1,4 +1,4 @@
FROM node:10.11-alpine as build-frontend-deps
FROM node:12.16-alpine as build-frontend-deps
ARG CI
ARG DRONE
@@ -13,7 +13,7 @@ ADD frontend/package.json /srv/frontend/package.json
ADD frontend/package-lock.json /srv/frontend/package-lock.json
RUN cd /srv/frontend && CI=true npm ci
FROM node:10.11-alpine as build-frontend
FROM node:12.16-alpine as build-frontend
ARG CI
ARG NODE_ENV=production
@@ -26,13 +26,11 @@ RUN cd /srv/frontend && \
npm run build && \
rm -rf ./node_modules
FROM umputun/baseimage:buildgo as build-backend
FROM umputun/baseimage:buildgo-latest as build-backend
ARG GITHUB_TOKEN
ENV SKIP_BACKEND_TEST=true
RUN go get github.com/rakyll/statik
WORKDIR /build/backend
ADD backend /build/backend
ADD README.md /build/