Skip to content

Commit

Permalink
remove php && use sed
Browse files Browse the repository at this point in the history
  • Loading branch information
pikeszfish committed Sep 19, 2016
1 parent 7f60b32 commit efadbf4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 25 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
@@ -1,5 +1,5 @@
# Using a compact OS
FROM php:5-zts-alpine
FROM alpine:latest

MAINTAINER Golfen Guo <golfen.guo@daocloud.io>

Expand All @@ -15,4 +15,4 @@ COPY . /usr/share/nginx/html
EXPOSE 80

# Start Nginx and keep it running background and start php
CMD nginx -g "pid /tmp/nginx.pid; daemon on;" && php -S 0.0.0.0:8888 /usr/share/nginx/html/hostname.php
CMD sed -i "s/ContainerID: /ContainerID: "$(hostname)"/g" /usr/share/nginx/html/index.html && nginx -g "pid /tmp/nginx.pid; daemon off;"
6 changes: 0 additions & 6 deletions hostname.php

This file was deleted.

1 change: 1 addition & 0 deletions index.html
Expand Up @@ -18,6 +18,7 @@
</head>
<body>
<div class="container">
<p style="position:absolute;left:60px;top:100px;">ContainerID: </p>
<div class="heading">
<h1 class="title">2048</h1>
<div class="scores-container">
Expand Down
17 changes: 0 additions & 17 deletions js/application.js
Expand Up @@ -2,20 +2,3 @@
window.requestAnimationFrame(function () {
new GameManager(4, KeyboardInputManager, HTMLActuator, LocalStorageManager);
});

function httpGet(url) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
return xmlHttp.responseText;
}

function setContainerID() {
var hostname = httpGet("http://" + window.location.hostname + ":8888");
var container = document.getElementsByClassName("container")[0];
var tmp = document.createElement('div');
tmp.innerHTML = '<p style="position:absolute;left:60px;top:100px;">ContainerID: ' + hostname + "</p>";
container.insertBefore(tmp, container.children[0]);
}

setContainerID();

0 comments on commit efadbf4

Please sign in to comment.