Skip to main content

S3 Bucket

Config

package main

import (
"stakpak.dev/devx/v1"
"stakpak.dev/devx/v1/traits"
)

stack: v1.#Stack
stack: {
$metadata: stack: "myapp"
components: {
bucket: {
traits.#S3CompatibleBucket
s3: {
prefix: "guku-io-"
name: "my-bucket-123"
versioning: true
objectLocking: false
}
}
}
}

Build

devx build dev
devx build prod

Result

docker-compose.yml
version: "3"
volumes:
miniodata: null
services:
myminio:
image: minio/minio:RELEASE.2023-01-02T09-40-09Z.fips
environment:
MINIO_ACCESS_KEY: admin
MINIO_SECRET_KEY: adminadmin
depends_on: []
ports:
- "9000:9000"
- "9001:9001"
command:
- server
- /data
- -console-address
- :9001
restart: always
volumes:
- miniodata:/data
bucket:
image: minio/mc
depends_on:
- myminio
entrypoint: |-
/bin/sh -c "
/usr/bin/mc alias set myminio http://myminio:9000 admin adminadmin;
/usr/bin/mc mb myminio/guku-io-my-bucket-123;
/usr/bin/mc policy set public myminio/guku-io-my-bucket-123;
exit 0;
"
restart: "no"