Skip to content

Commit

Permalink
feature: add Dockerfile and update README + GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
evoxmusic committed Dec 1, 2024
1 parent 0238db9 commit 2a168da
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 9 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout code
Expand Down Expand Up @@ -55,4 +58,24 @@ jobs:
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM debian:bookworm-slim

# Install necessary packages
RUN apt update && apt install -y \
wget \
curl \
gnupg \
unzip \
lsb-release \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Add PostgreSQL repository and install postgresql-client
RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/postgresql-archive-keyring.gpg] http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt update \
&& apt install -y postgresql-client \
&& rm -rf /var/lib/apt/lists/*

# Download and install MongoDB database tools
RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-x86_64-100.10.0.tgz \
&& tar -xvf mongodb-database-tools-debian12-x86_64-100.10.0.tgz \
&& mv mongodb-database-tools-debian12-x86_64-100.10.0/bin/* /usr/local/bin/ \
&& rm -rf mongodb-database-tools-debian12-x86_64-100.10.0*

# Add MySQL repository and install default-mysql-client
RUN apt update \
&& apt install -y default-mysql-client \
&& rm -rf /var/lib/apt/lists/*

# Download and install MigrationDB
RUN wget -O migrationdb.zip https://github.com/Qovery/migration-db/releases/download/v0.2/migrationdb-linux-arm64.zip \
&& unzip migrationdb.zip \
&& mv migrationdb-linux-arm64 /usr/local/bin/migrationdb \
&& chmod +x /usr/local/bin/migrationdb \
&& rm migrationdb.zip

# Set the entrypoint to migrationdb
ENTRYPOINT ["migrationdb"]
36 changes: 28 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,39 @@ MigrationDB is a robust database migration tool that enables streaming data tran

## Installation

### On MacOS
### Using Docker

Clone the repository and build the Docker image:

```bash
brew install migrationdb
git clone https://github.com/Qovery/migration-db.git
cd migration-db
docker build -f Dockerfile . --tag migrationdb
```

### On Linux

*Coming soon*

### On Windows
### Using Docker for Migrations

*Coming soon*
```bash
# Basic migration
docker run -it --rm migrationdb \
--source postgresql://user:pass@source:5432/dbname \
--target postgresql://user:pass@target:5432/dbname

# Stream to local file
docker run -it --rm migrationdb \
--source postgresql://user:pass@source:5432/dbname \
--stdout > dump.sql

# Validate connections
docker run -it --rm migrationdb validate \
--source postgresql://user:pass@source:5432/dbname \
--target postgresql://user:pass@target:5432/dbname

# Using custom network for database access
docker run -it --rm --network=my-network migrationdb \
--source postgresql://user:pass@source-db:5432/dbname \
--target postgresql://user:pass@target-db:5432/dbname
```

## Usage

Expand Down

0 comments on commit 2a168da

Please sign in to comment.