Skip to content

Commit

Permalink
fix(docker): Memory issue with Docker deploying (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
NriotHrreion committed Aug 30, 2024
1 parent 84fcd35 commit 9f1b4f1
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:20-bullseye

COPY . /calcium/
WORKDIR /calcium/
Expand All @@ -7,4 +7,4 @@ RUN npm i

EXPOSE 3000

ENTRYPOINT npm run start
ENTRYPOINT npm run docker:start
71 changes: 49 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"eslint": "^8.3.0",
"eslint-config-react-app": "^7.0.1",
"eslint-webpack-plugin": "^3.1.1",
"express": "^4.19.2",
"file-loader": "^6.2.0",
"flag-icons": "^7.1.0",
"fs-extra": "^10.0.0",
Expand Down Expand Up @@ -82,6 +83,7 @@
},
"scripts": {
"start": "node scripts/start.js",
"docker:start": "node scripts/docker-start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},
Expand Down
28 changes: 28 additions & 0 deletions scripts/docker-start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use strict";

const { exec } = require("child_process");
const path = require("path");

const chalk = require("react-dev-utils/chalk");
const express = require("express");

console.log(chalk.cyan("Building Calcium in production mode...\n"));

exec("npm run build", (err) => {
if(err) {
console.log(chalk.red(err));

return;
}

const app = express();

app.use(express.static(path.join(__dirname, "..", "build")));

app.listen(3000, () => {
console.log(
chalk.green("Calcium is ready on"),
chalk.greenBright(chalk.bold("http://localhost:3000"))
);
});
});

1 comment on commit 9f1b4f1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.