Skip to content

Commit

Permalink
Consolidated satis-s3 images
Browse files Browse the repository at this point in the history
Previously mojdigital/satis-s3 was based on iainmackay/satis-s3.
Now they have been consolidated into one image.
This was to allow the arguments to run.sh to be modified,
as previously they were hardcoded in iainmackay/satis-s3.
These arguments can now be specified as environment variables.

This step was taken, due to the changes to the CircleCi YML format.
The previous was volumes were mounted could not be replicated with the 2.0 format.
  • Loading branch information
jsmcgd committed Apr 5, 2019
1 parent 6a9e393 commit 2e49c62
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 19 deletions.
24 changes: 23 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
FROM iainmckay/satis-s3
FROM php:5-cli

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update \
&& apt-get install -yq --no-install-recommends python-setuptools python-pip git zlib1g-dev openssh-client \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& pip install awscli

RUN docker-php-ext-install zip

RUN echo "date.timezone = UTC" >> /usr/local/etc/php/php.ini \
&& curl -sS https://getcomposer.org/installer | php \
&& php composer.phar create-project composer/satis --stability=dev \
&& ln /satis/bin/satis /usr/local/bin

RUN mkdir ~/.ssh \
&& ssh-keyscan -H bitbucket.org >> /root/.ssh/known_hosts \
&& ssh-keyscan -H github.com >> /root/.ssh/known_hosts

#FROM iainmckay/satis-s3

# Update composer and satis to the latest versions
RUN docker-php-ext-install mbstring && \
Expand Down
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# satis-s3

A docker image to build a composer repository using [satis](https://github.com/composer/satis), and upload it to an AWS S3 bucket.
A docker image to build a composer repository using [satis](https://github.com/composer/satis),
and upload it to an AWS S3 bucket.

This image extends [iainmckay/satis-s3](https://github.com/iainmckay/satis-s3).
This is based on (but no longer extends) [iainmckay/satis-s3](https://github.com/iainmckay/satis-s3).

## Configuration

The script requires the following environment variables:
The script recognizes the following environment variables.
For development and testing purposes, copy .env.example to .env and specify the correct environment variables

Name | Description | Required
---- | ----------- | --------
`AWS_ACCESS_KEY_ID` | Your AWS access key | Required
`AWS_SECRET_ACCESS_KEY` | Your AWS secret access key | Required
`AWS_DEFAULT_REGION` | The AWS region the bucket is in | Required
`GITHUB_AUTH` | [Personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) for access to GitHub. Use this to avoid hitting GitHub API rate limits. | Optional
`S3_BUCKET` | The bucket to write the artifacts to | Required
`S3_PATH` | The path inside the bucket to write the artifacts to | Optional
#### Required environment variables

- `AWS_ACCESS_KEY_ID` Your AWS access key

- `AWS_SECRET_ACCESS_KEY` Your AWS secret access key

- `AWS_DEFAULT_REGION` The AWS region the bucket is in

- `CONFIG_PATH` The path to the Satis config.json file

- `OUT_PATH` The path of where the Satis repo should be built

- `S3_BUCKET` The bucket to write the artifacts to

#### Optional environment variables

- `GITHUB_AUTH` [Personal access token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) for access to GitHub. Use this to avoid hitting GitHub API rate limits.

- `S3_PATH` The path inside the bucket to write the artifacts to
11 changes: 4 additions & 7 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ set -e
# Adapted from run.sh in iainmckay/satis-s3
# Source: https://github.com/iainmckay/satis-s3/blob/ce9d960d54aa1e6fcb888c88f6ddc1e4cd2c7c30/run.sh

SATIS=$1
CONFIG_PATH=$2
OUT_PATH=$3
SATIS=/satis/bin/satis

if [ -z "$SATIS" ] || [ -z "$CONFIG_PATH" ] || [ -z "$OUT_PATH" ]; then
>&2 echo "run.sh <path to satis script> <path to config.json> <output path>"
if [ -z "$CONFIG_PATH" ] || [ -z "$OUT_PATH" ]; then
>&2 echo "run.sh <path to config.json> <output path>"
exit 1
fi

if [ ! -z "$GITHUB_AUTH" ]; then
echo "Configuring Composer GitHub auth..."
/composer.phar config -g github-oauth.github.com "$GITHUB_AUTH"
/composer.phar config --global github-oauth.github.com "$GITHUB_AUTH"
fi

mkdir -p $OUT_PATH
Expand Down

0 comments on commit 2e49c62

Please sign in to comment.