I'm a web dev and I use node. A colleague has added code to my branch that uses the thrift npm package. Although thrift is a npm package, it needs to be installed on the local machine still for the package to be used. I do not have apache thrift installed and cannot run the code. I will eventually have to deploy this code so I'd like to look into creating a docker container that has thrift available and the nodejs code can run in that container using the thrift installation.
I cannot find a container for this purpose. There is an official docker image with the thrift library, but that seems like it only runs thrift files. there is also an the node container of course, any way I can combine the two?
Check this docker file which contains both nodejs and thrift. I directly build this image from appache/thift which is official docker image of thrift and install nodejs and npm.
FROM apache/thrift
RUN apt-get update && apt-get install -y --no-install-recommends curl sudo
RUN curl --silent --location https://deb.nodesource.com/setup_8.x | sudo bash - && \
apt-get install --yes nodejs && \
apt-get install --yes build-essential
RUN apt-get install --yes npm
ENTRYPOINT ["/bin/bash", "-c"]
CMD ["/bin/bash"]
Build command:
docker build -t thrift-node .
Run command
docker run --name test-thrift - -p 3000:3000 --rm -it thrift-node
Verify version command
thrift -version
nodejs -v
npm -v