skip build steps with ARG and compose #143 (#144)

This commit is contained in:
Umputun
2018-07-08 18:43:58 -05:00
committed by GitHub
parent bcd28306e2
commit 43092bb644
4 changed files with 70 additions and 13 deletions
+19 -9
View File
@@ -12,27 +12,33 @@ ARG TRAVIS_PULL_REQUEST
ARG TRAVIS_PULL_REQUEST_SHA
ARG TRAVIS_REPO_SLUG
ARG TRAVIS_TAG
ARG DRONE
ARG DRONE_TAG
ARG DRONE_COMMIT
ARG DRONE_BRANCH
ARG DRONE_PULL_REQUEST
ARG SKIP_BACKEND_TEST
WORKDIR /go/src/github.com/umputun/remark/backend
ADD backend /go/src/github.com/umputun/remark/backend
RUN cd app && go test ./...
RUN cd app && \
if [ -z "$SKIP_BACKEND_TEST" ] ; then go test ./... ; \
else echo "skip backend test" ; fi
RUN gometalinter --disable-all --deadline=300s --vendor --enable=vet --enable=vetshadow --enable=golint \
RUN if [ -z "$SKIP_BACKEND_TEST" ] ; then \
gometalinter --disable-all --deadline=300s --vendor --enable=vet --enable=vetshadow --enable=golint \
--enable=staticcheck --enable=ineffassign --enable=goconst --enable=errcheck --enable=unconvert \
--enable=deadcode --enable=gosimple --enable=gas --exclude=test --exclude=mock --exclude=vendor ./...
--enable=deadcode --enable=gosimple --enable=gas --exclude=test --exclude=mock --exclude=vendor ./... ; \
else echo "skip backend linters" ; fi
# coverage test, submit to coverals if COVERALLS_TOKEN in env
RUN mkdir -p target && /script/coverage.sh
RUN if [ -z "$COVERALLS_TOKEN" ] ; then \
echo coverall not enabled ; \
else goveralls -coverprofile=.cover/cover.out -service=travis-ci -repotoken $COVERALLS_TOKEN || echo "coverall failed!"; fi
else \
mkdir -p target && /script/coverage.sh && \
goveralls -coverprofile=.cover/cover.out -service=travis-ci -repotoken $COVERALLS_TOKEN || echo "coverall failed!"; fi
# get revision from git. if DRONE presented use DRONE_* git env to make version
RUN \
@@ -45,12 +51,16 @@ RUN \
FROM node:9.4-alpine as build-frontend
ARG CI
ARG SKIP_FRONTEND_TEST
ADD web /srv/web
RUN apk add --no-cache --update git
RUN \
cd /srv/web && \
npm i && npm run lint && npm run test && npm run build && \
rm -rf ./node_modules
cd /srv/web && npm i && \
if [ -z "$SKIP_FRONTEND_TEST" ] ; then npm run lint && npm run test ; \
else echo "skip frontend tests and lint" ; fi && \
npm run build && rm -rf ./node_modules
FROM umputun/baseimage:app-latest
+2 -2
View File
@@ -224,8 +224,8 @@ Also you can use fully functional local version to develop and test both fronten
To bring it up run:
```bash
docker-compose -f compose-dev.yml build
docker-compose -f compose-dev.yml up
docker-compose -f compose-dev-frontend.yml build
docker-compose -f compose-dev-frontend.yml up
```
It starts Remark42 on `localhost:8080`
+6 -2
View File
@@ -6,7 +6,12 @@ version: '2'
services:
remark42:
build: .
build:
context: .
dockerfile: Dockerfile
args:
- SKIP_FRONTEND_TEST=true
image: umputun/remark42:dev
container_name: "remark42-dev"
hostname: "remark42-dev"
@@ -33,6 +38,5 @@ services:
- ADMIN=dev_user # set admin flag for default user on local ouath2
volumes:
- ./var:/srv/var
#- ./web:/srv/web # uncomment to map web directory directly. It will propagate local changes to container without redeploy
command: /srv/start.sh
+43
View File
@@ -0,0 +1,43 @@
# compose file for local development
# starts backend on 8080 with basic auth "dev:password" and Dev oauth2 provider on port 8084
# UI on https://127.0.0.1:8080/web
version: '2'
services:
remark42:
build:
context: .
dockerfile: Dockerfile
args:
- SKIP_BACKEND_TEST=true
image: umputun/remark42:dev
container_name: "remark42-dev"
hostname: "remark42-dev"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
ports:
- "8080:8080" # primary rest server
- "8084:8084" # local oauth2 server
environment:
- USER # preset environment, UID on the host machine, i.e `id -u`
- REMARK_URL=http://127.0.0.1:8080
- SECRET=12345
- STORE_BOLT_PATH=/srv/var/db
- BACKUP_PATH=/srv/var/backup
- DEBUG=true
- DEV_PASSWD=password
- AUTH_DEV=true # activate local oauth "dev"
- ADMIN=dev_user # set admin flag for default user on local ouath2
volumes:
- ./var:/srv/var
# - ./web/public:/srv/web # uncomment to allow direct deployment of web parts
command: /srv/start.sh