Add target in the Makefile to build the docker image

This commit is contained in:
Grégoire Delattre 2017-02-02 14:39:48 +01:00 committed by Lucas BEE
parent b6a09743eb
commit c386f12613
3 changed files with 19 additions and 1 deletions

View File

@ -1,4 +1,4 @@
.PHONY: docker migration dev clean test
.PHONY: docker migration dev clean test build_docker_image
DB_USER=test
DB_PASS=test
@ -24,6 +24,14 @@ docker:
$(DOCKER_COMPOSE) up -d
sleep 8
build_docker_image:
rm -rf canapeapp
mkdir canapeapp
yarn build
CGO_ENABLED=0 go build -v -o canapeapp/app src/main.go
docker build --tag canapeapp:latest --file docker/Dockerfile-production .
rm -rf canapeapp
migration-schema: docker
$(MIGRATION) -path $(MIGRATION_SCHEMA) up

View File

@ -0,0 +1,6 @@
FROM alpine:3.5
COPY canapeapp /opt/canapeapp
WORKDIR /opt/canapeapp
RUN chmod +x /opt/canapeapp
CMD ["/opt/canapeapp"]

View File

@ -2,6 +2,10 @@ var webpack = require("webpack");
var path = require("path");
var BUILD_DIR = path.resolve(__dirname, 'build/public/');
if (process.env.NODE_ENV === 'production') {
BUILD_DIR = path.resolve(__dirname, 'canapeapp/public/');
}
var SRC_DIR = path.resolve(__dirname, 'src/public/js');
const config = {