Python - Convert Visual Studio Project to Docker Image with all dependencies












-1














I have just started to coding Python. And developing a Hello World application with using Flask.



Scenario is basically like that;




  1. Write program in Python which will act as http server (you can use Flask or any other modules)


1.1 Server should accept GET requests for any path (http://localhost/*)



1.2 Server should return html page which will contain value of URI path



Example: http://localhost/hello_world should return html page with hello_world



1.3 Put this program to GitHub with README.md describing how-to setup environment and start program




  1. Convert this application to Docker image with all dependencies


  2. Upload this image to Docker Hub and provide its name



I think, I have completed first item. Also you can see the basic application here.



My question is, can I convert a Visual Studio Python Project to Docket Image. And does my project provide the requirements? I will be so glad if you can comment for it.



Thanks in advance.










share|improve this question
























  • I don't think Visual Studio has a feature that will do it all for you. It's going to be multiple steps.
    – OrangeDog
    Nov 23 '18 at 14:52
















-1














I have just started to coding Python. And developing a Hello World application with using Flask.



Scenario is basically like that;




  1. Write program in Python which will act as http server (you can use Flask or any other modules)


1.1 Server should accept GET requests for any path (http://localhost/*)



1.2 Server should return html page which will contain value of URI path



Example: http://localhost/hello_world should return html page with hello_world



1.3 Put this program to GitHub with README.md describing how-to setup environment and start program




  1. Convert this application to Docker image with all dependencies


  2. Upload this image to Docker Hub and provide its name



I think, I have completed first item. Also you can see the basic application here.



My question is, can I convert a Visual Studio Python Project to Docket Image. And does my project provide the requirements? I will be so glad if you can comment for it.



Thanks in advance.










share|improve this question
























  • I don't think Visual Studio has a feature that will do it all for you. It's going to be multiple steps.
    – OrangeDog
    Nov 23 '18 at 14:52














-1












-1








-1







I have just started to coding Python. And developing a Hello World application with using Flask.



Scenario is basically like that;




  1. Write program in Python which will act as http server (you can use Flask or any other modules)


1.1 Server should accept GET requests for any path (http://localhost/*)



1.2 Server should return html page which will contain value of URI path



Example: http://localhost/hello_world should return html page with hello_world



1.3 Put this program to GitHub with README.md describing how-to setup environment and start program




  1. Convert this application to Docker image with all dependencies


  2. Upload this image to Docker Hub and provide its name



I think, I have completed first item. Also you can see the basic application here.



My question is, can I convert a Visual Studio Python Project to Docket Image. And does my project provide the requirements? I will be so glad if you can comment for it.



Thanks in advance.










share|improve this question















I have just started to coding Python. And developing a Hello World application with using Flask.



Scenario is basically like that;




  1. Write program in Python which will act as http server (you can use Flask or any other modules)


1.1 Server should accept GET requests for any path (http://localhost/*)



1.2 Server should return html page which will contain value of URI path



Example: http://localhost/hello_world should return html page with hello_world



1.3 Put this program to GitHub with README.md describing how-to setup environment and start program




  1. Convert this application to Docker image with all dependencies


  2. Upload this image to Docker Hub and provide its name



I think, I have completed first item. Also you can see the basic application here.



My question is, can I convert a Visual Studio Python Project to Docket Image. And does my project provide the requirements? I will be so glad if you can comment for it.



Thanks in advance.







python visual-studio docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 15:09

























asked Nov 23 '18 at 11:21









Cagin B.

11




11












  • I don't think Visual Studio has a feature that will do it all for you. It's going to be multiple steps.
    – OrangeDog
    Nov 23 '18 at 14:52


















  • I don't think Visual Studio has a feature that will do it all for you. It's going to be multiple steps.
    – OrangeDog
    Nov 23 '18 at 14:52
















I don't think Visual Studio has a feature that will do it all for you. It's going to be multiple steps.
– OrangeDog
Nov 23 '18 at 14:52




I don't think Visual Studio has a feature that will do it all for you. It's going to be multiple steps.
– OrangeDog
Nov 23 '18 at 14:52












1 Answer
1






active

oldest

votes


















1














Sure you can. With a quick Google search you could find several solutions.



From the Python DockerHub page:



FROM python:3.6
# Copy and install requirements for the app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# Execute the program
CMD ["python", "your-main-file-here.py"]


After that you need an account to DockerHub and you can push your generated image there.



As for the requirements, if you are using a virtual environment, you can simply do pip freeze > requirements.txt and that should generate the requirements for you. Otherwise you're gonna have to generate the contents yourself. Unless Visual Studio can somehow(i'm not aware) track the used libraries.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445765%2fpython-convert-visual-studio-project-to-docker-image-with-all-dependencies%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Sure you can. With a quick Google search you could find several solutions.



    From the Python DockerHub page:



    FROM python:3.6
    # Copy and install requirements for the app
    COPY requirements.txt ./
    RUN pip install --no-cache-dir -r requirements.txt

    COPY . .

    # Execute the program
    CMD ["python", "your-main-file-here.py"]


    After that you need an account to DockerHub and you can push your generated image there.



    As for the requirements, if you are using a virtual environment, you can simply do pip freeze > requirements.txt and that should generate the requirements for you. Otherwise you're gonna have to generate the contents yourself. Unless Visual Studio can somehow(i'm not aware) track the used libraries.






    share|improve this answer


























      1














      Sure you can. With a quick Google search you could find several solutions.



      From the Python DockerHub page:



      FROM python:3.6
      # Copy and install requirements for the app
      COPY requirements.txt ./
      RUN pip install --no-cache-dir -r requirements.txt

      COPY . .

      # Execute the program
      CMD ["python", "your-main-file-here.py"]


      After that you need an account to DockerHub and you can push your generated image there.



      As for the requirements, if you are using a virtual environment, you can simply do pip freeze > requirements.txt and that should generate the requirements for you. Otherwise you're gonna have to generate the contents yourself. Unless Visual Studio can somehow(i'm not aware) track the used libraries.






      share|improve this answer
























        1












        1








        1






        Sure you can. With a quick Google search you could find several solutions.



        From the Python DockerHub page:



        FROM python:3.6
        # Copy and install requirements for the app
        COPY requirements.txt ./
        RUN pip install --no-cache-dir -r requirements.txt

        COPY . .

        # Execute the program
        CMD ["python", "your-main-file-here.py"]


        After that you need an account to DockerHub and you can push your generated image there.



        As for the requirements, if you are using a virtual environment, you can simply do pip freeze > requirements.txt and that should generate the requirements for you. Otherwise you're gonna have to generate the contents yourself. Unless Visual Studio can somehow(i'm not aware) track the used libraries.






        share|improve this answer












        Sure you can. With a quick Google search you could find several solutions.



        From the Python DockerHub page:



        FROM python:3.6
        # Copy and install requirements for the app
        COPY requirements.txt ./
        RUN pip install --no-cache-dir -r requirements.txt

        COPY . .

        # Execute the program
        CMD ["python", "your-main-file-here.py"]


        After that you need an account to DockerHub and you can push your generated image there.



        As for the requirements, if you are using a virtual environment, you can simply do pip freeze > requirements.txt and that should generate the requirements for you. Otherwise you're gonna have to generate the contents yourself. Unless Visual Studio can somehow(i'm not aware) track the used libraries.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 '18 at 11:34









        GaidarOS

        185




        185






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445765%2fpython-convert-visual-studio-project-to-docker-image-with-all-dependencies%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)