am i doing something wrong with this docker file?
# Use the official Directus image as base
FROM directus/directus:11.3.5
# Create an entrypoint script
COPY <<EOF /docker-entrypoint-custom.sh
#!/bin/bash
set -e
touch /data/database/data.db
# Execute the original entrypoint with the provided arguments
exec docker-entrypoint.sh "$@"
EOF
# Use our custom entrypoint
ENTRYPOINT ["/docker-entrypoint-custom.sh"]
CMD ["node", "/directus/cli.js", "start"]
No errors shown on deployment related to the build however the terminal stuck at ‘creating fly machine’ and then abort after a couple of minutes.
Here is the toml file:
# fly.toml app configuration file generated for directusteachme on 2025-01-10T11:15:07-06:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'directusteachme'
primary_region = 'qro'
[build]
dockerfile = 'Dockerfile'
[env]
DB_CLIENT = 'sqlite3'
DB_FILENAME = '/data/database/data.db'
EXTENSIONS_AUTO_RELOAD = 'true'
EXTENSIONS_PATH = '/data/extensions'
PORT = '8055'
PUBLIC_URL = 'https://directusteachme.fly.dev'
STORAGE_LOCAL_ROOT = '/data/uploads'
WEBSOCKETS_ENABLED = 'true'
[[mounts]]
source = 'direcuts_data'
destination = '/data'
[http_service]
internal_port = 8055
force_https = true
auto_stop_machines = 'off'
auto_start_machines = false
min_machines_running = 1
processes = ['app']
[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
The exact error i receive is:
=> => pushing layer sha256:958a7b6dfe2efe4a3b0324f8680d2ec31aa404e4cbcba383cecdf51ca22f98e5 9.1s
=> => pushing manifest for registry.fly.io/directusteachme:deployment-01JH8KDK39XRSJ63GESNS54D53@sha256:96ee36c957a6df7ec0 1.5s
--> Build Summary: ()
--> Building image done
image: registry.fly.io/directusxxx:deployment-01JH8KDK39XRSJ63GESNS54D53
image size: 142 MB
Watch your deployment at https://fly.io/apps/directusxxx/monitoring
Provisioning ips for directusteachme
Dedicated ipv6: XXXX
Shared ipv4: XXX
Add a dedicated ipv4 with: fly ips allocate-v4
Creating a 1 GB volume named 'direcuts_data' for process group 'app'. Use 'fly vol extend' to increase its size
This deployment will:
* create 1 "app" machine
No machines in group app, launching a new machine
WARN failed to release lease for machine 080e397a140958 [app]: lease not found
-------
✖ Failed: timeout reached waiting for machine's state to change
-------
Error: timeout reached waiting for machine's state to change
Your machine was created, but never started. This could mean that your app is taking a long time to start,
but it could be indicative of a region issue.
You can try deploying to a different region,
or you can try increasing the timeout with the --wait-timeout flag
Update:
Apparently there is a problem to handle the bash symbol or something like that with fly. Anyway this worked:
# Use the official Directus image as base
FROM directus/directus:11.3.5
# Create necessary directories at runtime and start the application
# Correct way to create directories and start Directus
CMD ["sh", "-c", "mkdir -p /directus/data/database && mkdir -p /directus/data/uploads && mkdir -p /directus/data/extensions && touch /directus/data/database/data.db && node /directus/cli.js bootstrap && node /directus/cli.js start"]