Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerized net8 #78

Merged

Conversation

lessismore-sparkvision
Copy link
Contributor

docker run --rm
-v "${CURRENT_DIR_WIN}/settings.yml:/app/settings.yml"
-v "${BACKUP_DIR}:/app/backups"
scmbackup:latest || { echo "ERROR: Failed to start Bitbucket backup."; exit 1; }

Documentation needed.

@christianspecht christianspecht merged commit 4d13e93 into christianspecht:master Jun 5, 2024
1 check passed
@christianspecht
Copy link
Owner

Documentation needed.

Can you elaborate what kind of documentation is needed? (besides the "docker run" command above)
I have almost zero Docker experience.

@lessismore-sparkvision lessismore-sparkvision deleted the dockerized-net8 branch June 11, 2024 08:41
@lessismore-sparkvision
Copy link
Contributor Author

Little experience to document a Docker app, as well.

It should boil down to 3 things - what I normally look for:

  • Dockerfile
  • build command
  • run command

Dockerfile:
The Dockerfile was made using Visual Studio and it's now becoming the standard layout for a dockerfile. Earlier, one documented each step in the dockerfile. The link at the top describes the multi-stage build that now is being used:
Customize Docker containers..

Build:
docker build . --force-rm -t scmbackup:1.8.0 --build-arg BUILD_CONFIGURATION=Debug --label "com.microsoft.created-by=visual-studio" --label "com.microsoft.visual-studio.project-name=ScmBackup"

Run:
docker run --rm
-v "${CURRENT_DIR_WIN}/settings.yml:/app/settings.yml"
-v "${BACKUP_DIR}:/app/backups"
scmbackup:1.8.0 || { echo "ERROR: Failed to start Bitbucket backup."; exit 1; }

@lessismore-sparkvision
Copy link
Contributor Author

Open a terminal and navigate to your project root directory:

cd C:\...\scm-backup

Then run the Docker build command:

docker build -f ./src\/ScmBackup/Dockerfile . --force-rm -t scmbackup:1.8.0 --build-arg BUILD_CONFIGURATION=Debug --label "com.microsoft.created-by=visual-studio" --label "com.microsoft.visual-studio.project-name=ScmBackup"

Explanation:
-f ./src/ScmBackup/Dockerfile: Specifies the relative path to the Dockerfile.
.: Specifies the build context as the current directory (which should be the root of your project containing the src directory).
--force-rm: Forces the removal of intermediate containers after a successful build.
-t scmbackup:1.8.0: Tags the image with scmbackup:1.8.0.
--build-arg BUILD_CONFIGURATION=Debug: Passes the build argument BUILD_CONFIGURATION with a value of Debug.
--label "com.microsoft.created-by=visual-studio": Adds a label to the image indicating it was created by Visual Studio.
--label "com.microsoft.visual-studio.project-name=ScmBackup": Adds a label to the image with the project name.

@lessismore-sparkvision
Copy link
Contributor Author

I am sharing my bash script, which is used to run the backup process. As it's still under development, please use it at your own discretion.

#!/bin/bash

# ***********************************************************************************************
# Backup Bitbucket repos using SCM Backup docker image.
# ***********************************************************************************************

#set -x  # Enable debugging mode
set -e  # Enable exit immediately on error

# Print input variables
echo "Input variables..."
echo ""

# Get current date in YYYY-MM-DD format
CURRENT_DATE=$(date +%Y-%m-%d)
echo "CURRENT DATE: $CURRENT_DATE"

# Get current time in HHMM format without the colon character
CURRENT_TIME=$(date +%H%M)
echo "CURRENT TIME: $CURRENT_TIME"

# Get timestamp as short date and short time
SHORT_DATE_AND_TIME="${CURRENT_DATE}_${CURRENT_TIME}"
echo "SHORT DATE AND TIME: $SHORT_DATE_AND_TIME"

# Get current directory in Windows format
CURRENT_DIR_WIN=$(cygpath -w "$(pwd)")
echo "CURRENT_DIR_WIN: $CURRENT_DIR_WIN"

# Define backup directory path
BACKUP_DIR="${CURRENT_DIR_WIN}\backups\bitbucket_repo_backup_${SHORT_DATE_AND_TIME}"
echo "BACKUP_DIR: $BACKUP_DIR"

# Create the backup directory if it doesn't already exist
mkdir -p "$BACKUP_DIR"

# Run Docker container to perform backup
docker run --rm \
    -v "${CURRENT_DIR_WIN}/settings.yml:/app/settings.yml" \
    -v "${BACKUP_DIR}:/app/backups" \
    scmbackup:1.8.0 || { echo "ERROR: Failed to start Bitbucket backup."; exit 1; }

@lessismore-sparkvision
Copy link
Contributor Author

Then there is the question if you would like to publicize your Dockerized app and its image. Then you need to use container registry like Docker Hub, GitHub Container Registry, Google Container Registry, or Amazon Elastic Container Registry (ECR). Then, there should be a clear and concise documentation explaining how to use your Dockerized app, which we don't have for the moment.

Anyone else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants