Skip to content

Commit

Permalink
Update docker
Browse files Browse the repository at this point in the history
  • Loading branch information
gRoussac committed Mar 4, 2024
1 parent 67e50d9 commit fabe91c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# syntax=docker/dockerfile:1

FROM debian:10.9-slim
FROM debian:12.4-slim
RUN apt-get update && apt-get install -y unzip wget
SHELL ["/bin/bash", "--login", "-c"]
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
RUN . ~/.bashrc
RUN nvm install --lts
WORKDIR /app
Expand All @@ -13,6 +13,7 @@ RUN unzip -q ./*.zip -d ${TMP}
RUN mv ${TMP}/*/casper-sdk/ ./
RUN mv ${TMP}/*/w* ./ && rm -rf ${TMP} *.zip
WORKDIR /app/www
ENV PORT=4200
RUN npm install --verbose
RUN npm run build --verbose
CMD npm run serve
4 changes: 2 additions & 2 deletions www/dist/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ app.all('/escrow', function(req, res) {
app.use('/', express.static(path.join(__dirname, 'apps/frontend/')));

const apiProxy = proxy.createProxyMiddleware('/api', { target: 'http://localhost:3333' });
app.get('/api/*', apiProxy);
app.use('/api/*', apiProxy);

const eventsProxy = proxy.createProxyMiddleware('/events', { target: 'http://localhost:3333' });
app.get('/events/*', eventsProxy);
app.use('/events/*', eventsProxy);

app.listen(port);
console.log('Server started at http://localhost:' + port);
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class StateRootHashComponent implements OnDestroy, AfterViewInit {
this.window = this.document.defaultView;
this.defaults = [
this.config['default_node_localhost'],
this.config['default_node_docker'],
this.config['default_node_testnet'],
this.config['default_node_integration'],
this.config['default_node_mainnet'],
Expand All @@ -61,7 +62,7 @@ export class StateRootHashComponent implements OnDestroy, AfterViewInit {
if (currentHost && this.defaults[0].includes(currentHost)) {
this.apiUrl = this.defaults[0];
} else {
this.apiUrl = this.defaults[1];
this.apiUrl = this.defaults[2];
}
}
this.getPeers();
Expand Down
6 changes: 5 additions & 1 deletion www/libs/util/config/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ export type EnvironmentConfig = {
const rpc_port = '7777';
const sse_port = '9999';
const rpc_port_localhost = '11101';
const currentPort = window?.location?.port;
const protocol = window.location.protocol;
const currentPort = window?.location?.port || (protocol === "https:" ? "443" : "80");
const sse_port_localhost = currentPort || '4200';
const localhost = "http://localhost";
const dockerhost = "http://172.17.0.1";
const default_node_localhost = [localhost, rpc_port_localhost].join(':');
const default_node_docker = [dockerhost, rpc_port_localhost].join(':');
const default_node_testnet = "https://rpc.testnet.casperlabs.io";
const default_node_integration = "https://rpc.integration.casperlabs.io";
const default_node_mainnet = "https://rpc.mainnet.casperlabs.io";
Expand All @@ -21,6 +24,7 @@ export const config: EnvironmentConfig = {
eventsUrl_localhost: [localhost, sse_port_localhost].join(':'),
eventsUrl_default: events_main_suffix,
default_node_localhost,
default_node_docker,
default_node_testnet,
default_node_integration,
default_node_mainnet,
Expand Down

0 comments on commit fabe91c

Please sign in to comment.