

If you run into issues setting up this tutorial, or any other problems with our product, feel free to drop us a line in support and we’ll be happy to answer any questions for you.In this tutorial, you learn how to use a MySQL database in your Node.js project with Docker. That’s it! If everything went well you should be able to visit your dashboard and check on the status of your test suite. This will be available in your Ghost Inspector tests under with your own values. Also note that you can send custom variables to the API call when we execute your test suite by using a custom environment variable named GI_PARAM_varName where varName is the name of your variable. Finally we also connect this new container to the same my-test-network so all the DNS and networking magic can happen. Notice that for APP_PORT we’ve passed in my-app:8000, my-app will resolve to our running docker container that we named my-app and 8000 assumes that is the port that our application is running on. Make sure you change out all the environment variables to your own custom values for NGROK_TOKEN, GI_API_KEY, and GI_SUITE. This should be the Node.js entrypoint of your application, in our case it looks like: The last line of our Dockerfile is going to be the CMD. Note that all environment variables will also be available to your application in the process.env object. You may include additional variables required by your tests. GI_PARAM_myVar (optional) - additional URL parameter to send to our API, the value of which will be accessible in your test under myVar.STARTUP_DELAY (optional) - seconds to wait for application and ngrok each to start up, defaults to 3 seconds.NGROK_TOKEN - available from your ngrok account.GI_SUITE - the ID of the Ghost Inspector test suite you wish to run against your app.GI_API_KEY - available in your Ghost Inspector account.APP_PORT - tells the test running script which port your application is running on.Some of the environment variables are required: In order for this image to successfully interact with your application we will need to provide some configuration at runtime, either for the test running script, or for your Ghost Inspector test suite. Next we will need to adjust the environment variables for the test runner to execute properly, and then adjust our CMD accordingly. This Dockerfile simple extends our ghostinspector/test-runner-node image, copies our application files, and installs the application. # Configure the test runner ENV APP_PORT 3000 ENV GI_API_KEY ENV GI_SUITE ENV GI_PARAM_myVar some-custom-value ENV NGROK_TOKEN # Pass your application entrypoint into our test runner script CMD
#Node js docker file buddy code#

Base image ( ghostinspector/test-runner-node) - image for testing your application within a single Docker container.We offer two different Docker images to aide in testing your containerized app: Docker installed in your local or test environment.You will need the auth token provided in your account. An account with ngrok.io, a free utility used for local tunneling.Execute with VPN tunnel to local applicationīefore we get started we are going to need the following:.In this tutorial we’re going to look at a couple different ways we can test our containerized applications using Ghost Inspector. Docker is a popular and powerful method for packaging and deploying your modern web application. This tutorial assumes you have some familiarity with building, configuring, and running Dockerized applications. Building and testing Docker applications is an advanced topic.
