Updated dockerfile to work with jekyll and ruby2.2.5, and added circle-ci...

Updated dockerfile to work with jekyll and ruby2.2.5, and added circle-ci config file + kubectl config, using kasperrt/static_uninett as FROM for faster buildtime
parent 91516afc
FROM nginx
FROM kasperrt/static_uninett:build-2
COPY site /srv/www/site
COPY .bowerrc /srv/www/.bowerrc
......@@ -10,15 +10,6 @@ COPY bower.json /srv/www/bower.json
WORKDIR /srv/www
ADD default.conf /etc/nginx/conf.d/default.conf
RUN apt-get update && apt-get install -y curl npm python2.7 ruby-full git
RUN ln -s `which nodejs` /usr/bin/node
RUN rm -rf /var/lib/apt/lists/*
RUN gem install jekyll --no-ri --no-rdoc
RUN gem install rouge --no-ri --no-rdoc
RUN npm install
RUN node_modules/bower/bin/bower install --config.interactive=false -p --allow-root
RUN jekyll build
......@@ -32,4 +23,4 @@ RUN curl -o /srv/www/dist/bower_components/uninett-theme/fonts/colfaxRegularItal
EXPOSE 80
EXPOSE 443
\ No newline at end of file
EXPOSE 443
machine:
environment:
# PROJECT_NAME: turnkey-cocoa-720
# CLUSTER_NAME: cluster-1
# CLOUDSDK_COMPUTE_ZONE: europe-west1-c
DEBIAN_FRONTEND: noninteractive
CONTAINER_NAME: saml2int
IMAGE_BASE: uninettno/saml2int
IMAGE: ${IMAGE_BASE}:build-${CIRCLE_BUILD_NUM}
# KUBERNETES_SERVER: https://104.155.105.25
# KUBERNETES_DEPLOYMENT: feidernd
# KUBERNETES_DEPLOYMENT_TESTING: feidernd-testing
services:
- docker
dependencies:
pre:
# - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
# - sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update kubectl
# This is not really used right now..
# - echo $GKE_SERVICE_ACCOUNT | base64 --decode -i > ${HOME}/account-auth.json
# - sudo /opt/google-cloud-sdk/bin/gcloud config set project $PROJECT_NAME
# - sudo /opt/google-cloud-sdk/bin/gcloud --quiet config set container/cluster $CLUSTER_NAME
# Reading the zone from the env var is not working so we set it here
# - sudo /opt/google-cloud-sdk/bin/gcloud config set compute/zone ${CLOUDSDK_COMPUTE_ZONE}
# - sudo chown -R ubuntu:ubuntu ${HOME}/.kube
# - kubectl config set-credentials circleci --token=${GKE_SERVICE_TOKEN}
# - kubectl config set-credentials admin --username=admin --password=${GKE_ADMIN_PASSWD}
# - kubectl config set-cluster cluster-1 --server=${KUBERNETES_SERVER} --insecure-skip-tls-verify=true
# - kubectl config set-context gce --user=admin --cluster=cluster-1 --namespace=production
# - kubectl config use-context gce
# - kubectl config view
# - kubectl version
# - kubectl get pods
# - kubectl get serviceaccounts
# Using a separate tag command until Docker 1.10 is available on CircleCI, then we can use two tags in the build command above
# - gcloud docker push
- echo "Build ${CIRCLE_BUILD_NUM} branch ${CIRCLE_BRANCH}" > build.txt && cat build.txt
- echo "ENV CBUILDNUM ${CIRCLE_BUILD_NUM}" >> ./Dockerfile
- echo "ENV CBRANCH ${CIRCLE_BRANCH}" >> ./Dockerfile
- cat Dockerfile
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
- docker build -t ${IMAGE} .
# - docker tag ${IMAGE_BASE}:$CIRCLE_SHA1 ${IMAGE_BASE}:testing-${CIRCLE_BUILD_NUM}
- docker push ${IMAGE_BASE}
# Automatically configure kubectl
# - sudo /opt/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file ${HOME}/account-auth.json
# - sudo /opt/google-cloud-sdk/bin/gcloud --quiet container clusters get-credentials $CLUSTER_NAME
# test:
# post:
# - docker run -d -p 3000:3000 -e "SECRET_KEY_BASE=abcd1234" eu.gcr.io/${PROJECT_NAME}/${CONTAINER_NAME}:$CIRCLE_SHA1; sleep 10
# - curl --retry 10 --retry-delay 5 -v http://localhost:3000
test:
override:
- /bin/true
#- docker run -d -p 80:80 ${IMAGE}; sleep 10
#- curl --retry 10 --retry-delay 5 -v http://localhost:80
deployment:
preprod:
branch: master
commands:
- echo "Deployment [MASTER / Preprod] ${IMAGE}"
# - kubectl patch deployment ${KUBERNETES_DEPLOYMENT_TESTING} -p "{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"${KUBERNETES_DEPLOYMENT_TESTING}\",\"image\":\"${IMAGE}\"}]}}}}"
# - kubectl exec `kubectl --namespace production get pods -l 'appid=feidernd' -o jsonpath={.items[*].metadata.name}` /app/bin/migratedb.sh
# - kubectl exec deployment ${KUBERNETES_DEPLOYMENT_TESTING} -p "{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"${KUBERNETES_DEPLOYMENT_TESTING}\",\"image\":\"${IMAGE}\"}]}}}}"
# - ./bin/migratedb.sh
prod:
branch: stable
commands:
- echo "Deployment [STABLE / Production] ${IMAGE}"
# - kubectl patch deployment ${KUBERNETES_DEPLOYMENT} -p "{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"${KUBERNETES_DEPLOYMENT}\",\"image\":\"${IMAGE}\"}]}}}}"
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /srv/www/dist;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
\ No newline at end of file
{
"apiVersion": "extensions/v1beta1",
"kind": "Deployment",
"metadata": {
"name": "saml2int"
},
"spec": {
"replicas": 1,
"strategy": {
"type": "RollingUpdate",
"rollingUpdate": {
"maxUnavailable": 0,
"maxSurge": 1
}
},
"template": {
"metadata": {
"labels": {
"app": "saml2int",
"appid": "saml2int"
}
},
"spec": {
"containers": [{
"name": "saml2int",
"image": "uninettno/saml2int:build-1",
"resources": {
"requests": {
"cpu": "10m",
"memory": "200Mi"
},
"limits": {
"memory": "800Mi"
}
},
"env": [{
"name": "HOST",
"value": "saml2int.no"
}, {
"name": "TLS",
"value": "true"
}],
"imagePullPolicy": "Always",
"ports": [{
"containerPort": 80
}],
"volumeMounts": [{
"name": "saml2int",
"mountPath": "/etc/secrets",
"readOnly": true
}]
}],
"restartPolicy": "Always",
"volumes": [{
"name": "saml2int",
"secret": {
"secretName": "saml2int"
}
}]
}
}
}
}
\ No newline at end of file
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "saml2int"
},
"spec": {
"selector": {
"appid": "saml2int"
},
"ports": [{
"protocol": "TCP",
"port": 80,
"targetPort": 80
}, {
"protocol": "TCP",
"port": 443,
"targetPort": 443
}],
"type": "NodePort"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment