Skip to content

Docker Deployment

PROJECT ZERO edited this page Jan 18, 2025 · 1 revision

Docker Deployment

Building the Docker Image

To build the Docker image for the application, follow these steps:

  1. Navigate to the project directory:

    cd project-red-sword
  2. Build the Docker image:

    docker build -t project-red-sword .

Running the Docker Container

To run the Docker container for the application, follow these steps:

  1. Run the Docker container:

    docker run -p 7860:7860 project-red-sword

Pushing the Docker Image to a Registry

To push the Docker image to a container registry, follow these steps:

  1. Tag the Docker image:

    docker tag project-red-sword your-registry/project-red-sword
  2. Push the Docker image:

    docker push your-registry/project-red-sword

Deploying the Docker Container on Cloud Platforms

AWS Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Push the Docker image to AWS ECR:

    aws ecr get-login-password --region YOUR_AWS_REGION | docker login --username AWS --password-stdin YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com
    aws ecr create-repository --repository-name project-red-sword || echo "Repository already exists."
    docker tag project-red-sword:latest YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/project-red-sword
    docker push YOUR_AWS_ACCOUNT_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/project-red-sword
  3. Deploy to AWS Elastic Beanstalk:

    eb init -p docker project-red-sword --region YOUR_AWS_REGION
    eb create project-red-sword-env

Azure Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Push the Docker image to Azure ACR:

    az acr login --name YOUR_AZURE_ACR_NAME
    az acr create --resource-group YOUR_RESOURCE_GROUP --name YOUR_AZURE_ACR_NAME --sku Basic || echo "Registry already exists."
    docker tag project-red-sword:latest YOUR_AZURE_ACR_NAME.azurecr.io/project-red-sword
    docker push YOUR_AZURE_ACR_NAME.azurecr.io/project-red-sword
  3. Deploy to Azure App Service:

    az webapp create --resource-group YOUR_RESOURCE_GROUP --plan YOUR_APP_SERVICE_PLAN --name YOUR_APP_NAME --deployment-container-image-name YOUR_AZURE_ACR_NAME.azurecr.io/project-red-sword:latest

Google Cloud Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Push the Docker image to Google Container Registry:

    gcloud auth configure-docker
    docker tag project-red-sword gcr.io/YOUR_PROJECT_ID/project-red-sword
    docker push gcr.io/YOUR_PROJECT_ID/project-red-sword
  3. Deploy to Google Kubernetes Engine:

    kubectl apply -f google-k8s.yaml

DigitalOcean Deployment

  1. Build the Docker image:

    docker build -t project-red-sword .
  2. Deploy to DigitalOcean:

    doctl auth init
    doctl apps create --spec digitalocean-app.yaml

TABLE OF CONTENTS

Clone this wiki locally