Public | Automated Build

Last pushed: 10 months ago
Short Description
Short description is empty for this repo.
Full Description

S3 Assets Deploy

A Dockerized script to deploy static assets for an application to S3.

The application static assets should be made available to the script by injecting it as a volume.


# Pull the assets deploy image from the image registry.
docker pull nytinteractive/assets-deploy:latest

# Build an image of the application.
docker build --tag=your-application .

# Run the container so a volume of the public assets can be extracted.
# Assets must exist in the application's container at `/usr/src/app/public/`
docker run --name your-application-assets -v /usr/src/app/public/ your-application echo 'loading assets'

# Run the assets deploy with the volume from the application.
docker run --rm --volumes-from your-application-assets -e AWS_BUCKET={AWS_BUCKET_HERE} -e STORAGE_PATH={STORAGE_PATH_HERE} -e AWS_ACCESS_KEY_ID='{AWS_KEY_ID_HERE}' -e AWS_SECRET_ACCESS_KEY='{AWS_SECRET_ACCESS_KEY_HERE}' nytinteractive/assets-deploy

Note that AWS keys often have special characters that can have unpredictable expansions in bash, so should be enclosed in quotes. Example:

docker run -i -t --name assets-deploy --volumes-from scoop-that -e -e STORAGE_PATH=docker/scoop-that/assets -e AWS_ACCESS_KEY_ID='<access_id>' -e AWS_SECRET_ACCESS_KEY='<secret_key>' assets-deploy

In this case, scoop-that is the name of your running scoop-that container, and assets-deploy is the name of this image.

Docker Pull Command
Source Repository

Comments (0)