Skip to content

Commit

Permalink
build(api): Installation with pre-built Docker image (#70)
Browse files Browse the repository at this point in the history
* feat: add Dockerfile and build script

* docs(api): add installation instructions with pre-built Docker image
  • Loading branch information
EdouardDem authored May 9, 2024
1 parent 04369a0 commit bf23190
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 6 deletions.
8 changes: 8 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG DIRECTUS_VERSION=latest

FROM node:20-alpine as extensions
WORKDIR /extensions
RUN npm install directus-extension-sync

FROM --platform=${TARGETPLATFORM} directus/directus:${DIRECTUS_VERSION}
COPY --from=extensions /extensions/node_modules/directus-extension-sync ./extensions/directus-extension-sync
49 changes: 49 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Docker image

This Docker image extends the official Directus Docker images with the extension `directus-extension-sync` pre-installed.

It can be used to quickly set up a Directus instance to use with the [`directus-sync` CLI](https://github.com/tractr/directus-sync).

The `directus-sync` command-line interface (CLI) provides a set of tools for managing and synchronizing the schema and collections within Directus across different environments.

## Usage

### Run with Docker Compose

Create a `docker-compose.yml` file with the following content:

```yaml
version: '3.8'

services:
directus:
image: tractr/directus-sync:latest
restart: unless-stopped
ports:
- '8055:8055'
environment:
KEY: 'XXXXXXXX'
SECRET: 'XXXXXXXX'
ADMIN_EMAIL: '[email protected]'
ADMIN_PASSWORD: 'password'
```
Then, run:
```bash
docker-compose up -d
```

### Run with Docker

Run the following command:

```bash
docker run -d -p 8055:8055 \
-e KEY=XXXXXXXX \
-e SECRET=XXXXXXXX \
-e [email protected] \
-e ADMIN_PASSWORD=password \
tractr/directus-sync:latest
```

42 changes: 42 additions & 0 deletions docker/build-and-push.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env zx

const directusVersions = [
'latest',

'10',

'10.9',
'10.9.0',
'10.9.1',
'10.9.2',
'10.9.3',

'10.10',
'10.10.0',
'10.10.1',
'10.10.2',
'10.10.3',
'10.10.4',
'10.10.5',
'10.10.6',
'10.10.7',

'10.11',
'10.11.0',
];

const platforms = [
'linux/amd64',
// 'linux/arm64',
];

for (const version of directusVersions) {
await $`docker buildx build \
-t tractr/directus-sync:${version} \
--build-arg DIRECTUS_VERSION=${version} \
--platform ${platforms.join(',')} .`;
}

for (const version of directusVersions) {
await $`docker push tractr/directus-sync:${version}`;
}
19 changes: 13 additions & 6 deletions packages/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,33 @@ npm install directus-extension-sync

Then, restart Directus.

### Installation with Docker
### Use pre-built Docker image

If you are using Directus with Docker, you can install the extension by creating a custom Dockerfile.
You can use the pre-built Docker image with this extension pre-installed.

See example in this issue: https://github.com/tractr/directus-sync/issues/63#issuecomment-2096657924
This image is available on Docker Hub: [tractr/directus-sync](https://hub.docker.com/r/tractr/directus-sync).

### Installation within custom Docker image

If you prefer to build your own Docker image, you can follow the instructions from this
issue: https://github.com/tractr/directus-sync/issues/63#issuecomment-2096657924

### Installation with Directus Marketplace

Unfortunately, the extension is not available in the Directus Marketplace out of the box.
Directus Marketplace does not support extensions that require a database connection ([more details here](https://docs.directus.io/extensions/sandbox/sandbox-sdk.html#reference)).
Directus Marketplace does not support extensions that require a database
connection ([more details here](https://docs.directus.io/extensions/sandbox/sandbox-sdk.html#reference)).

**However**, you can force Directus Marketplace to show all extensions by setting the `MARKETPLACE_TRUST` environment variable to `all`.
**However**, you can force Directus Marketplace to show all extensions by setting the `MARKETPLACE_TRUST` environment
variable to `all`.

```bash
MARKETPLACE_TRUST=all
```

Then, go to the Directus Marketplace and search for the `directus-extension-sync` extension.

![Marketplace installation](docs/marketplace.png)
![Marketplace installation](https://raw.githubusercontent.com/tractr/directus-sync/main/packages/api/docs/marketplace.png)

## Usage

Expand Down

0 comments on commit bf23190

Please sign in to comment.