1
1
mirror of https://github.com/aelve/guide.git synced 2024-12-24 13:26:08 +03:00
guide/Makefile
Vladislav Sabanov 7d9d8ec84e
Make docker and upload (#279)
* Make docker and upload

* Try to allow failures

* Allow failures npm

* Or True

* Or true

* Remove or true

* Fix config files

* Test cp

* Find dist

* Fix stage

* where is make

* Fix cd

* Remove checkers

* Fix dockerfile

* Add env to dockerfile

* Comment envs

* Set api=localhost

* Fix dockerfile and win

* Trigger on push
2019-04-24 20:25:12 +05:00

58 lines
1.7 KiB
Makefile

SHELL := /bin/bash
# Build the project
.PHONY: back
back:
stack build --fast
# Run tests
.PHONY: back/test
back/test:
stack test --fast
# Download the official database
.PHONY: back/db
back/db:
rm -rf back/state
git clone --depth 1 https://github.com/aelve/guide-database.git
mv guide-database back/state
# Test that the official database can be loaded
.PHONY: back/test-db
back/test-db: back
if [ -d back/state ]; then mv back/state back/state-old; fi
git clone --depth 1 https://github.com/aelve/guide-database.git
mv guide-database back/state
(cd back/state && git branch -v && git status && ls)
stack exec --cwd back -- guide --dry-run
rm -rf back/state
if [ -d back/state-old ]; then mv back/state-old back/state; fi
# Run the backend
.PHONY: back/run
back/run:
stack exec --cwd back -- guide
# Create a Docker image for the backend; will only work on Travis because
# the binary has to have been compiled on Ubuntu Trusty (the OS used in the
# Docker file)
.PHONY: back/travis-docker
back/travis-docker:
rm -rf docker/back/files && mkdir docker/back/files
git clone --depth 1 https://github.com/aelve/guide-database.git \
docker/back/files/state
rm -rf docker/back/files/state/.git
cp .stack-work/install/*/*/*/bin/guide docker/back/files/
cp -R back/{static,templates} docker/back/files/
docker build docker/back -t quay.io/aelve/guide:$(tag)
rm -rf docker/back/files
# Create a Docker image for the front;
.PHONY: front/travis-docker
front/travis-docker:
rm -rf docker/front/files && mkdir docker/front/files
cp -R front/dist docker/front/files/
cd ./docker/front/files/dist/ && export NODE_ENV=production && npm install
docker build docker/front -t quay.io/aelve/guide:$(tag)
rm -rf docker/front/files