3 ms·
Honestly, I just wrote my Dockerfile using the example from the official Python container: https://hub.docker.com/_/python/ https://hub.docker.com/_/python/ Th
by amyjess 9y ago
Honestly, I just wrote my Dockerfile using the example from the official Python container: https://hub.docker.com/_/python/ https://hub.docker.com/_/python/
Then I push the image to my company's internal Docker registry, ssh into the server, and pull the image.
(also, aside from using Python 3 on RHEL 6, it also means using Python 3.6 on RHEL 7 without having to install python36u)
Edit:
Dockerfile (script name redacted)
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./redacted.py" ]
Build and push commands (company and script names redacted):
docker build --rm -t dreg.example.com/redactedproject/redacted .
docker push dreg.example.com/redactedproject/redacted
Pull and run on the server (same stuff redacted as above, plus I redacted the actual port number to be on the safe side):
docker pull dreg.example.com/redactedproject/redacted
docker run -p 1337:1337 -d --name redacted dreg.example.com/redactedproject/redacted
And at some point, I'll make proper startup scripts for them. On RHEL 7 boxes, I've made systemd unit files. On RHEL 6... well, I suppose I'll be writing initscripts soon.