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

Updated Docker Build Process #17

Merged
merged 4 commits into from
Feb 28, 2024
Merged

Updated Docker Build Process #17

merged 4 commits into from
Feb 28, 2024

Conversation

jyeary
Copy link
Contributor

@jyeary jyeary commented Feb 22, 2024

This should get a running Docker Compose. I did need to modify a file in the main openboxes project called _Events.groovy to handle an issue with SASS by adding --unsafe-perm to the npm run bundle command. The complete method is shown below.

eventRunAppStart = {
	log.info "Setting build date, build number, and revision number ..."
  	def revisionNumber = determineGitRevisionNumber()
    def branchName = determineGitBranchName()

	def buildNumber = metadata.'app.buildNumber'
	if (!buildNumber) buildNumber = 1

	metadata.'app.revisionNumber' = revisionNumber
    metadata.'app.branchName' = branchName
	metadata.'app.buildDate' = new java.text.SimpleDateFormat("d MMM yyyy hh:mm:ss a").format(new java.util.Date());
	metadata.'app.buildNumber' = buildNumber.toString()
	//metadata.persist()

    println "Building React frontend"
    def command = """npm run bundle --unsafe-perm"""
    def proc = command.execute()
    proc.waitFor()
    println "${proc.in.text}"
    if (proc.exitValue() != 0) {
        event("ReactBuildFailed", ["React build FAILED"])
    } else {
        println "React build finished"
    }
}

@jmiranda
Copy link
Member

@awalkowiak Can you take a look at this when you get a chance?

Copy link
Member

@jmiranda jmiranda left a comment

Choose a reason for hiding this comment

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

@jyeary I just got a chance to run a branch with your changes and I keep getting stuck here. I made the change to _Events.groovy in the main openboxes repository, but it just sits there. Any ideas?

openboxes-docker-grails-1  | Using configuration locations [classpath:openboxes-config.properties, classpath:openboxes-config.groovy, file:/root/.grails/openboxes-config.properties, file:/root/.grails/openboxes-config.groovy] [development]
openboxes-docker-grails-1  | Unable to load specified config location classpath:openboxes-config.properties : class path resource [openboxes-config.properties] cannot be opened because it does not exist
openboxes-docker-grails-1  | Unable to load specified config location classpath:openboxes-config.groovy : class path resource [openboxes-config.groovy] cannot be opened because it does not exist
openboxes-docker-grails-1  | Unable to load specified config location file:/root/.grails/openboxes-config.groovy : /root/.grails/openboxes-config.groovy (No such file or directory)
openboxes-docker-grails-1  | [native2ascii] Converting 14 files from /app/grails-app/i18n to /root/.grails/1.3.9/projects/app/resources/grails-app/i18n
openboxes-docker-grails-1  |      [copy] Copying 1 file to /app/target/classes
openboxes-docker-grails-1  |      [copy] Copying 5 files to /root/.grails/1.3.9/projects/app/resources
openboxes-docker-grails-1  | 2024-02-28 02:56:44,510 [main] INFO  cfg.Environment  - Hibernate 3.3.1.GA
openboxes-docker-grails-1  | 2024-02-28 02:56:44,512 [main] INFO  cfg.Environment  - hibernate.properties not found
openboxes-docker-grails-1  | 2024-02-28 02:56:44,513 [main] INFO  cfg.Environment  - Bytecode provider name : javassist
openboxes-docker-grails-1  | 2024-02-28 02:56:44,514 [main] INFO  cfg.Environment  - using JDK 1.4 java.sql.Timestamp handling
openboxes-docker-grails-1  |      [copy] Copying 1 file to /root/.grails/1.3.9/projects/app
openboxes-docker-grails-1  | 2024-02-28 02:56:46,256 [main] INFO  warehouse._Events  - Setting build date, build number, and revision number ...
openboxes-docker-grails-1  | 2024-02-28 02:56:46,261 [main] INFO  warehouse._Events  - Setting git revision number 
openboxes-docker-grails-1  | 2024-02-28 02:56:46,263 [main] INFO  warehouse._Events  - Executing command git branch | grep \* | cut -d ' '
openboxes-docker-grails-1  | 2024-02-28 02:56:46,264 [main] INFO  warehouse._Events  - Done executing command:
openboxes-docker-grails-1  | 2024-02-28 02:56:46,264 [main] INFO  warehouse._Events  - Setting git branch to 
openboxes-docker-grails-1  | Building React frontend

@jmiranda
Copy link
Member

Disregard for now, I'm thinking this is an issue with the .node_modules so I'm going to start fresh and see if I still encounter the issue.

@jmiranda
Copy link
Member

After starting over with a new cloned repository (i.e. essentially removing node_modules) I was able to see the errors being output by the npm run bundle command.

I've attached the full log file openboxes-docker-grails-1.log

A lot of the errors are of the form

ERROR in ./src/js/components/infoBar/InfoBar.jsx
Module not found: Error: Can't resolve 'react-icons/all' in '/app/src/js/components/infoBar'
 @ ./src/js/components/infoBar/InfoBar.jsx 3:0-46 25:40-51
 @ ./src/js/components/Layout/Header.jsx
 @ ./src/js/components/Layout/MainLayout.jsx
 @ ./src/js/components/Layout/MainLayoutRoute.jsx
 @ ./src/js/components/Router.jsx
 @ ./src/js/MainRouter.jsx
 @ ./src/js/index.jsx

which is either a bug with the react-icons package
react-icons/react-icons#740

or makes me suspect that I need to run npm install manually before running.

docker-compose up

But why?

@jmiranda
Copy link
Member

jmiranda commented Feb 28, 2024

Manually running npm install worked for me in this case. Therefore I'm going to merge this PR and create a ticket for the npm install issue.

Edit: Created ticket #18 for the unresolved issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants