Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update the DockerCoin images since old one didn't work #55

Open
wants to merge 1 commit into
base: mastery
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockercoins/hasher/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ruby:alpine
RUN apk add --update build-base curl
RUN gem install sinatra
RUN gem install sinatra -v 3.1.0
RUN gem install thin
ADD hasher.rb /
CMD ["ruby", "hasher.rb"]
Expand Down
7 changes: 4 additions & 3 deletions dockercoins/webui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM node:4-slim
FROM node:23-slim
WORKDIR /app
RUN npm install express
RUN npm install redis
COPY files/ /files/
COPY webui.js /
COPY files/ files/
COPY webui.js .
CMD ["node", "webui.js"]
EXPOSE 80
28 changes: 18 additions & 10 deletions dockercoins/webui/webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ var express = require('express');
var app = express();
var redis = require('redis');

var client = redis.createClient(6379, 'redis');
var client = redis.createClient({
url: 'redis://redis:6379'
});

client.on("error", function (err) {
console.error("Redis error", err);
});
Expand All @@ -12,21 +15,26 @@ app.get('/', function (req, res) {
});

app.get('/json', function (req, res) {
client.hlen('wallet', function (err, coins) {
client.get('hashes', function (err, hashes) {
var now = Date.now() / 1000;
res.json( {
coins: coins,
hashes: hashes,
now: now
});
client.hLen('wallet').then(coins => {
client.get('hashes').then(
hashes =>
{
var now = Date.now() / 1000;
res.json({
coins: coins,
hashes: hashes,
now: now
});
});
});
});

app.use(express.static('files'));

var server = app.listen(80, function () {

client.connect().then(() => {
var server = app.listen(80, function () {
console.log('WEBUI running on port 80');
});
});