Monday, July 24, 2023

155: Docker

 Code that works on one machine does not always work on another. This can be for a variety of reasons, including the operating system and environment variables. Docker was created to solve this problem, allowing us to ship an image of our entire environment so our app can work reliably in production. Today I took my ffmpeg video compression server and containerized it with Docker. This involves creating a Dockerfile, which defined our Node 18 environment built on top of a Linux environment, along with which code to copy, commands to run, and ports to expose. From here we built and ran the image. With the image running, we used Thunder Client to send an HTTP Post request to our localhost server, and the video compressed successfully. Using the Docker CLI we were able to copy the original video into the Docker image, and then copy the compressed video out into our original folder. This is needed since the Docker image has its own filesystem. 

No comments:

Post a Comment

190: Sablier

 The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...