Skip to content

Instantly share code, notes, and snippets.

@DorkNstein
Last active July 9, 2020 15:16
Show Gist options
  • Save DorkNstein/311ebfea9219766db4a7d8e37de816cd to your computer and use it in GitHub Desktop.
Save DorkNstein/311ebfea9219766db4a7d8e37de816cd to your computer and use it in GitHub Desktop.
# For local test:
# Install docker in your local system
# For EC2 follow following instructions
# https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html
sudo yum update -y
sudo amazon-linux-extras install docker -y
sudo usermod -a -G docker ec2-user
sudo service docker start
sudo service docker restart # If sudo issues arise
# Create pdf_files folder for files storage
mkdir pdf_files
# Run docker for pdftk repo
# Checkout the php-pdftk repo
git clone https://bitbucket.org/7Tablets/php-pdftk.git
cd ./php-pdftk
# Copy .env file for environment variables
docker build -t dorknstein7t/pdftk-test .
docker run -dit -p 5000:5000 --rm -v /home/ec2-user/pdf_files:/usr/src/app/pdf_files/created dorknstein7t/pdftk-test /bin/bash
# If http://<ip>:5000/v1 is not responding
docker exec -it <container id> /bin/bash
npm i pm2 -g
pm2 start start.js --name="pdftk"
# Hit localhost:5000/v1 in browser to see if the server is running.
# UPDATE ENV FILE
docker cp .env <beautiful_lumiere(container name)>:/usr/src/app/.env
docker exec -it <container id> /bin/bash
pm2 restart 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment