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

setup: add docker file #930

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Utilize the Node.js 14 official image
Copy link
Contributor

Choose a reason for hiding this comment

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

Why node 14?

Copy link
Member Author

Choose a reason for hiding this comment

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

Outdated comment, have updated

FROM node:18-alpine
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the current latest version?

Copy link
Member Author

Choose a reason for hiding this comment

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

Current version in v20.17.0 using this one because in our volta package 18 version is pinned


USER root

# Set the working directory inside the container
WORKDIR /app

# Copy the package.json and package-lock.json (if available)
# COPY package*.json ./

# Install the dependencies


# Copy the rest of the application code
COPY . .

RUN yarn install --frozen-lockfile

# Build the Fastboot app
RUN yarn build

# Expose the port the Fastboot app runs on
EXPOSE 5000

# Define the command to run your Fastboot app
CMD ["node", "fastboot-server"]
Copy link
Contributor

Choose a reason for hiding this comment

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

How does the app know in which env to run

Copy link
Member Author

@satyam73 satyam73 Sep 14, 2024

Choose a reason for hiding this comment

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

For this we can have a two docker file one for production and one for staging with two different build commands

12 changes: 8 additions & 4 deletions app/constants/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const APP_URLS = {
TASKS: `${SCHEME}my.${DOMAIN}/tasks`,
IDENTITY: `${SCHEME}my.${DOMAIN}/identity`,
MY_STATUS: `${SCHEME}my.${DOMAIN}`,
API_BACKEND: `${SCHEME}api.${DOMAIN}`,
// API_BACKEND: `${SCHEME}api.${DOMAIN}`,hostWhitelist

API_BACKEND: `http://localhost:3000`,

Copy link
Contributor

Choose a reason for hiding this comment

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

Changed?

Copy link
Member Author

@satyam73 satyam73 Sep 14, 2024

Choose a reason for hiding this comment

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

Yes was testing, forgot to remove, thanks for pointing it out.
Update it now

DASHBOARD: `${SCHEME}dashboard.${DOMAIN}`,
},
staging: {
Expand All @@ -27,8 +30,8 @@ const APP_URLS = {
TASKS: `${SCHEME}staging-my.${DOMAIN}/tasks`,
IDENTITY: `${SCHEME}staging-my.${DOMAIN}/identity`,
MY_STATUS: `${SCHEME}staging-my.${DOMAIN}`,
API_BACKEND: `${SCHEME}staging-api.${DOMAIN}`,
DASHBOARD: `${SCHEME}staging-dashboard.${DOMAIN}`,
// API_BACKEND: `${SCHEME}staging-api.${DOMAIN}`,
API_BACKEND: `http://localhost:3000`,
},
development: {
HOME: `${SCHEME}staging-www.${DOMAIN}`,
Expand All @@ -41,7 +44,8 @@ const APP_URLS = {
IDENTITY: `${SCHEME}staging-my.${DOMAIN}/identity`,
MY_STATUS: `${SCHEME}staging-my.${DOMAIN}`,
DASHBOARD: `${SCHEME}staging-dashboard.${DOMAIN}`,
API_BACKEND: `${SCHEME}staging-api.${DOMAIN}`,
// API_BACKEND: `${SCHEME}staging-api.${DOMAIN}`,
API_BACKEND: `http://localhost:3000`,
},
test: {
HOME: `${SCHEME}${DOMAIN}`,
Expand Down
5 changes: 4 additions & 1 deletion fastboot-server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import FastBootAppServer from 'fastboot-app-server';
// import FastBootAppServer from 'fastboot-app-server';

// eslint-disable-next-line no-undef
const FastBootAppServer = require('fastboot-app-server');
const MY_GLOBAL = 'MY GLOBAL';
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not using commonjs? and using require?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was facing error in other files while I was using es6 code, so that's why instead of changing them I changed this one only


let server = new FastBootAppServer({
Expand All @@ -9,6 +11,7 @@ let server = new FastBootAppServer({
// Optional - Make values available to the Ember app running in the FastBoot server, e.g. "MY_GLOBAL" will be available as "GLOBAL_VALUE"
return Object.assign({}, defaultGlobals, { GLOBAL_VALUE: MY_GLOBAL });
},
port: 5000,
log: true, // Optional - Specifies whether the server should use its default request logging. Useful for turning off default logging when providing custom logging middlewares
chunkedResponse: true, // Optional - Opt-in to chunked transfer encoding, transferring the head, body and potential shoeboxes in separate chunks. Chunked transfer encoding should have a positive effect in particular when the app transfers a lot of data in the shoebox.
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"d3-cloud": "1.2.7",
"dotenv": "16.0.2",
"ember-d3": "0.5.1",
"exists-sync": "0.1.0",
"fastboot-app-server": "3.3.2"
"exists-sync": "0.1.0"
},
"devDependencies": {
"fastboot-app-server": "4.1.4",
"@babel/core": "7.24.7",
"@babel/eslint-parser": "7.24.7",
"@babel/plugin-proposal-decorators": "7.24.7",
Expand Down
57 changes: 35 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10071,25 +10071,17 @@ fast-sourcemap-concat@^2.1.0:
source-map-url "^0.3.0"
sourcemap-validator "^1.1.0"

fastboot-app-server@3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/fastboot-app-server/-/fastboot-app-server-3.3.2.tgz#7aadc5bfdda7b51a20005c26404959c1d80d098b"
integrity sha512-jQ+nsmcLhR49Bx1J/74eN/9yez5abzutnck91FdctWgwHMghuuas82v5hoqrKYSVq8I1J5RwS0v7WcICNLH1oA==
fastboot-app-server@4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/fastboot-app-server/-/fastboot-app-server-4.1.4.tgz#f3f1353cda694f9ce9fb4b3d498bea1ef81eb789"
integrity sha512-1XEP0vnZ8GPqWqo7YNMzfNRtH+x/l2OcRpPjuP/07vL8qozHxakb79DU2lcnDqOAmqz5aCYAHCXRrYF7SLCw0g==
dependencies:
basic-auth "^2.0.1"
chalk "^4.1.2"
compression "^1.7.4"
express "^4.17.2"
fastboot "3.3.2"
fastboot-express-middleware "3.3.2"

[email protected]:
version "3.3.2"
resolved "https://registry.yarnpkg.com/fastboot-express-middleware/-/fastboot-express-middleware-3.3.2.tgz#6d78de06f1db51f47b4f66658c651a61fcf5ca96"
integrity sha512-/Fgr29Q1bMDiv65BeCYmFR88otTg9QJYvmVIWrgkwWSkfya5h1XzCQYEz+VqyhWT1v+BQWq98SuyKfpNrL2cRA==
dependencies:
chalk "^4.1.2"
fastboot "3.3.2"
fastboot "4.1.5"
fastboot-express-middleware "4.1.2"

[email protected]:
version "4.1.1"
Expand All @@ -10099,6 +10091,14 @@ [email protected]:
chalk "^4.1.2"
fastboot "4.1.1"

[email protected]:
version "4.1.2"
resolved "https://registry.yarnpkg.com/fastboot-express-middleware/-/fastboot-express-middleware-4.1.2.tgz#6a383c282fdc07ee3f90039701bb0dab11129179"
integrity sha512-vnzEBV7gZ3lSoGiqG/7+006nHNA3z+ZnU/5u9jPHtKpjH28yEbvZq6PnAeTu24UR98jZVR0pnFbfX0co+O9PeA==
dependencies:
chalk "^4.1.2"
fastboot "4.1.2"

fastboot-transform@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/fastboot-transform/-/fastboot-transform-0.1.3.tgz#7dea0b117594afd8772baa6c9b0919644e7f7dcd"
Expand All @@ -10107,10 +10107,10 @@ fastboot-transform@^0.1.3:
broccoli-stew "^1.5.0"
convert-source-map "^1.5.1"

fastboot@3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/fastboot/-/fastboot-3.3.2.tgz#bf1ac7b01937846b63423a88138e13eb50406d2e"
integrity sha512-2NKTW32GvEsDyBrdw1trW1JsbS+9/7sAQuKwkht12mNitimRrSKVLP2AxsM/HSXQE+aiET4XCfKdyeIy0kQbKQ==
fastboot@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/fastboot/-/fastboot-4.1.1.tgz#b686dc522ef805557ff76ded23328c486991cbaa"
integrity sha512-XG7YprsAuAGZrUDhmJ0NFuEP0gpWg9LZwGWSS1I5+f0ETHKPWqb4x59sN2rU1nvCEETBK70z68tLsWsl9daomg==
dependencies:
chalk "^4.1.2"
cookie "^0.4.1"
Expand All @@ -10120,10 +10120,23 @@ [email protected]:
simple-dom "^1.4.0"
source-map-support "^0.5.21"

[email protected]:
version "4.1.1"
resolved "https://registry.yarnpkg.com/fastboot/-/fastboot-4.1.1.tgz#b686dc522ef805557ff76ded23328c486991cbaa"
integrity sha512-XG7YprsAuAGZrUDhmJ0NFuEP0gpWg9LZwGWSS1I5+f0ETHKPWqb4x59sN2rU1nvCEETBK70z68tLsWsl9daomg==
[email protected]:
version "4.1.2"
resolved "https://registry.yarnpkg.com/fastboot/-/fastboot-4.1.2.tgz#65627882d03962818f0f5331ca052d2da209ba98"
integrity sha512-VJLmF0xdCNwIIuA7DQtN1KTAKfEGsbZGJ0cfKh64h6DeMh3Fhr2FCCxkPh8zYqGoqzjXFdFbtk60WS3f6HKqBg==
dependencies:
chalk "^4.1.2"
cookie "^0.4.1"
debug "^4.3.3"
jsdom "^19.0.0"
resolve "^1.22.0"
simple-dom "^1.4.0"
source-map-support "^0.5.21"

[email protected]:
version "4.1.5"
resolved "https://registry.yarnpkg.com/fastboot/-/fastboot-4.1.5.tgz#ed24af3ed68a1a4428e8ff1dd0106c7edb2065ab"
integrity sha512-2FkJWrpxgJjy5kLb3KrYp0pKdB4WgT/6qxtQO7ozYtQqMBOAARMnp59xp/Hdosa1cE2jslZgwDAv3v11OlQfAw==
dependencies:
chalk "^4.1.2"
cookie "^0.4.1"
Expand Down
Loading