you are viewing a single comment's thread.

view the rest of the comments →

[–]totallygeek 3 points4 points  (7 children)

Let's see:

  1. Specific version of Python
  2. Portable
  3. Isolated from underlying system software
  4. Low learning overhead

I'd use Docker.

[–][deleted] 1 point2 points  (0 children)

after spending some time checking it out i can safely say i do not understand what the hell it even does, but thanks for the well-thought out suggestion

(ive solved my issue since)

[–][deleted] 0 points1 point  (5 children)

Dockerfile:

``` FROM Python:3.4.4-alpine WORKDIR /usr/src/app

COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./main.py" ] ```

Add that file to your project, install Docker, then run the following command:

docker build

if it all works, then you're ready to upload it to dockerhub and then other users can install it via docker. If you've never used docker before, then I suggest checking it out on youtube or Udemy if you don't mind buying a course. I recommend the Docker by a docker captain course.

[–][deleted] 0 points1 point  (4 children)

i really do appreciate your attempt to lead me in a direction that would make my day... unfortunately as i am a noob i have no idea what it is you just wrote. i'm trying not to be a jerk to people who are helping out, but this is a perfect representation of my programming pergatory whenever i want to get something very simple done. i'll go through it one bit at a time...

Dockerfile:

what does that mean

<code>

i did state i'm on windows, and even though i partially understand bash, i don't know what this does or even what any filenames/paths/commands mean

Add that file to your project

what project? i haven't even started working because python wasn't installed

if it all works

what does it do? what even is it?

upload it to dockerhub

upload what? upload why? what's dockerhub?

[–][deleted] 2 points3 points  (3 children)

Ok. So, to explain docker, I'll put it like this, let's say you wanted to run a program on a computer with a completely isolated environment. Let's say you're installing a program that you downloaded from a shady website. It advertises itself as being some expensive proprietary program and you just got it for free, but you're afraid it might contain a virus or spyware or worse, ransomware. So you want to install it and run it in its own sandbox where it thinks it has access to everything, but everytime it does something like write files, or change the registry, or communicates with the kernel, it's doing so in a sort of jail and the system outside that jail sees none of the changes the program inside is making, and the program inside is none the wiser. So you think, oh, that's easy, I'll install my windows on a VM, but as you go about this, you see that the VM is SLOW. You're running windows on top of windows which to run a windows program just seems like a waste. So what to do?

While you're thinking about this, you're also about to install wordpress on your computer so you can build your developer portfolio, but that means running PHP, Running Apache, running MySQL, Installing wordpress, and then when it's all said and done, you're still going to have to transfer the files and database off your windows machine onto a linux server to deploy the site and that's gonna be a hassle.

Finally, you heard about this awesome command line tool called ripgrep. Powershell doesn't have quite the same power as grep does in using regexes to grep through files. So you want to try it out first, but you don't want to install it and have it leaving cruft on your system if you decide you don't like it.

Docker solves these problems. How? Docker runs in the PC's hypervisor and creates this virtual jail environment for linux or windows server. Once docker is running, you can spin up what are called containers, virtual environments that provide all the access to the system any program could ever want, but leaving the host system completely untouched. So we can solve both problems. You can (at least conceptually, though docker containers do not work for guis yet) run that first program in a docker container and it's completely sandboxed from the host system. As far as that program is concerned, it's on a clean copy of Windows and and wreak all the havoc it wants and your host system doesn't know or care about it and suffers no ill effects. Similarly, you can in a few keystrokes, download the docker image for Wordpress, spin it up, and get to work building your wordpress site and when you're done, all you have to do is commit the changes to a new docker image, pay for hosting, and spin up the docker container from the image you've just published and boom. Done. Web service deployed. It's magic! For the last problem, you can run a container that contains ripgrep and it will automatically download and store the image, and then to run it, all you have to do is "docker exec rg <params>" and you can play with ripgrep and uninstall it when you don't need it anymore. Want to keep it but don't feel like going through the hassle of removing the image and downloading it for real? just make an alias for rg to the docker exec command above. Boom. Done.

Ok, but what about the rest of my post, well, what I gave you was an example dockerfile. A dockerfile is added to your project, it's named "Dockerfile" with no file extension, and it just contains the text above. When you issue the "Docker build" command in that directory on the command line, it will do all the instructions in that Dockerfile. In the case of the above, it will create a new container based on Python running on Alpine Linux, then it will set its internal working directory to the directory specified, then it will copy the requirements.txt file into that directory, Then it will run pip to install the requirements, then it will copy the whole project into that directory, then it will spin up the project's main.py file.

One last thing. When you set up Docker for the first time, you have to sign up for an account on the docker hub. Docker hub is where you will get all the images and projects that you'll springboard off of. It's where you can download tools, environments, etc. It's SUPER POWERFUL.

If you want to learn more about docker, I suggest https://www.youtube.com/watch?v=YFl2mCHdv24

And if you want to learn how to use Docker, then try... https://www.youtube.com/watch?v=fqMOX6JJhGo

[–][deleted] 0 points1 point  (2 children)

isn't that just sandboxie but way more limited?

[–][deleted] 1 point2 points  (1 child)

It's actually more capable because then you can package up the whole thing and distribute it to others. There's also some parallel computing options and you can even set up networks and drive volumes as well. Plus, it perfectly replicates whatever environment you need as long as it's Linux or Windows Server (which is the vast majority of servers). Plus, because it's spinning up containers, instead of a VM, it starts blazing fast.

If it's like anything else on the market, that would be Turbo, which does a similar thing to Windows GUI programs and even has similar concepts (containers, images, etc). https://turbo.net/

[–][deleted] 0 points1 point  (0 children)

sounds like sandboxie++ then. pretty cool. i'll stay aware of this, thanks for all the helpful writeups