diff --git a/docker/Dockerfile b/docker/Dockerfile index 7bed5dc..9c0f70a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 @@ -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 diff --git a/www/dist/server.js b/www/dist/server.js index 1cdce48..d9cbccf 100644 --- a/www/dist/server.js +++ b/www/dist/server.js @@ -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); \ No newline at end of file diff --git a/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts b/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts index 520f894..82f6948 100644 --- a/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts +++ b/www/libs/feature/deployer/src/lib/state-root-hash/state-root-hash.component.ts @@ -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'], @@ -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(); diff --git a/www/libs/util/config/src/config.ts b/www/libs/util/config/src/config.ts index 40f5777..5456c3a 100644 --- a/www/libs/util/config/src/config.ts +++ b/www/libs/util/config/src/config.ts @@ -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"; @@ -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,