mirror of
https://github.com/valitydev/checkout.git
synced 2024-11-06 02:25:18 +00:00
FE-58: integration to docker
This commit is contained in:
parent
886780fdc7
commit
eec40e7ce6
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "build_utils"]
|
||||
path = build_utils
|
||||
url = git+ssh://git@github.com/rbkmoney/build_utils
|
24
Dockerfile.sh
Executable file
24
Dockerfile.sh
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
cat <<EOF
|
||||
FROM $BASE_IMAGE
|
||||
MAINTAINER Ildar Galeev <i.galeev@rbkmoney.com>
|
||||
COPY dist /usr/share/nginx/html
|
||||
COPY nginx.conf /etc/nginx/vhosts.d/payform.js.conf
|
||||
COPY containerpilot.json /etc/containerpilot.json
|
||||
CMD /bin/containerpilot -config file:///etc/containerpilot.json /usr/sbin/nginx -g "daemon off;"
|
||||
LABEL base_image_tag=$BASE_IMAGE_TAG
|
||||
LABEL build_image_tag=$BUILD_IMAGE_TAG
|
||||
# A bit of magic to get a proper branch name
|
||||
# even when the HEAD is detached (Hey Jenkins!
|
||||
# BRANCH_NAME is available in Jenkins env).
|
||||
LABEL branch=$( \
|
||||
if [ "HEAD" != $(git rev-parse --abbrev-ref HEAD) ]; then \
|
||||
echo $(git rev-parse --abbrev-ref HEAD); \
|
||||
elif [ -n "$BRANCH_NAME" ]; then \
|
||||
echo $BRANCH_NAME; \
|
||||
else \
|
||||
echo $(git name-rev --name-only HEAD); \
|
||||
fi)
|
||||
LABEL commit=$(git rev-parse HEAD)
|
||||
LABEL commit_number=$(git rev-list --count HEAD)
|
||||
EOF
|
38
Jenkinsfile
vendored
Normal file
38
Jenkinsfile
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
#!groovy
|
||||
|
||||
build('tokenizer.js', 'docker-host') {
|
||||
checkoutRepo()
|
||||
loadBuildUtils()
|
||||
|
||||
def pipeDefault
|
||||
runStage('load pipeline') {
|
||||
env.JENKINS_LIB = "build_utils/jenkins_lib"
|
||||
pipeDefault = load("${env.JENKINS_LIB}/pipeDefault.groovy")
|
||||
}
|
||||
|
||||
pipeDefault() {
|
||||
//ToDo: npm stuff should be in a cache, when caching is implemented!
|
||||
runStage('init') {
|
||||
sh 'make wc_init'
|
||||
}
|
||||
runStage('build') {
|
||||
sh 'make wc_build'
|
||||
}
|
||||
runStage('build image') {
|
||||
sh 'make build_image'
|
||||
}
|
||||
|
||||
try {
|
||||
if (env.BRANCH_NAME == 'master') {
|
||||
runStage('push image') {
|
||||
sh 'make push_image'
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
runStage('rm local image') {
|
||||
sh 'make rm_local_image'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
42
Makefile
Normal file
42
Makefile
Normal file
@ -0,0 +1,42 @@
|
||||
SUBMODULES = build_utils
|
||||
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
|
||||
|
||||
UTILS_PATH := build_utils
|
||||
TEMPLATES_PATH := .
|
||||
|
||||
# Name of the service
|
||||
SERVICE_NAME := tokenizer.js
|
||||
# Service image default tag
|
||||
SERVICE_IMAGE_TAG ?= $(shell git rev-parse HEAD)
|
||||
# The tag for service image to be pushed with
|
||||
SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
|
||||
|
||||
# Base image for the service
|
||||
BASE_IMAGE_NAME := service-fe
|
||||
BASE_IMAGE_TAG := a58a828755e9d342ecbd7071e7dc224ffe546378
|
||||
|
||||
BUILD_IMAGE_TAG := 6fb209e428feaa0ef6cec07d3909d8a3c4013537
|
||||
|
||||
CALL_W_CONTAINER := init build clean submodules
|
||||
|
||||
.PHONY: $(CALL_W_CONTAINER)
|
||||
|
||||
all: build
|
||||
|
||||
-include $(UTILS_PATH)/make_lib/utils_image.mk
|
||||
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
||||
|
||||
$(SUBTARGETS): %/.git: %
|
||||
git submodule update --init $<
|
||||
touch $@
|
||||
|
||||
submodules: $(SUBTARGETS)
|
||||
|
||||
init:
|
||||
npm install
|
||||
|
||||
build:
|
||||
npm run build
|
||||
|
||||
clean:
|
||||
rm -rf dist
|
1
build_utils
Submodule
1
build_utils
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 4858499fdd62af516a2239d51d12d82be0921857
|
13
containerpilot.json
Normal file
13
containerpilot.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"consul": "{{ .CONSUL_ADDR }}",
|
||||
"services": [
|
||||
{
|
||||
"name": "{{ .SERVICE_NAME }}",
|
||||
"port": 8080,
|
||||
"health": "/usr/bin/curl --silent --show-error --output /dev/null localhost:8080",
|
||||
"poll": 1,
|
||||
"ttl": 2,
|
||||
"interfaces": ["inet6", "inet"]
|
||||
}
|
||||
]
|
||||
}
|
14
nginx.conf
Normal file
14
nginx.conf
Normal file
@ -0,0 +1,14 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"build": "gulp build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Loading…
Reference in New Issue
Block a user