Deployment React App using Space CI/CD

Hi! I'm running some issues trying to deploy a web app using Spaces.

As far as I know, after the job is completed everything is removed from the container, the question is:

- There is any way to keep/store the result of "npm run build" in a folder of the server running the automation process?
The only thing I was able to achieve was to store it on Space Cloud as a zip file.

This is the job I got:

job("Deploy React App"){
    startOn {
        gitPush {
            enabled = true
        }
    }
    
    container("node:16"){
        shellScript {
            content = """
                npm cache clean --force
                npm install --force
                npm run build
            """
        }

        fileArtifacts {
            localPath = "build"
            remotePath = "build.zip"
            archive = true
        }
    }
  
}

 

0
3 comments

David hi!

Could you please elaborate more on the goal that is behind storing the files on the server? Also, could you please let me know if you are using Space Cloud workers or self-hosted ones for your automation process?

 

0

Sorry, totally missed the message.

The goal of storing them on the server is basically to keep the build folder of my reactApp, and then point nginx to that folder, something like what I'm currently doing with GitHub actions.
I'm using self-hosted workers

0
Hello David,

Since you are using a self-hosted worker, you can install the nodejs on the worker itself and use the 'host' step (instead of 'container'). In the host step, you will be able to copy the files anywhere outside the worker's step dir and they will stay as static: https://www.jetbrains.com/help/space/run-steps-in-external-workers.html#directory-structure-in-automation-workers

0

Please sign in to leave a comment.