Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieIGG committed Nov 10, 2019
1 parent 8c84056 commit b027192
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 170 deletions.
26 changes: 13 additions & 13 deletions .semaphore/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: v1.0

name: 'Deploy Pipeline'
name: "Deploy Pipeline"

agent:
machine:
Expand All @@ -26,24 +26,24 @@ blocks:
jobs:
- name: Main App
commands:
- export RELEASE_IMAGE_TAG=564922552600.dkr.ecr.eu-central-1.amazonaws.com/icalialabs/testapp:${GIT_SHORT_SHA:-latest}
- export RELEASE_IMAGE_TAG=978175366817.dkr.ecr.us-west-2.amazonaws.com/charlieigg/startupapp:${GIT_SHORT_SHA:-latest}

- docker pull ${RELEASE_IMAGE_TAG}

- mkdir -p testapp && cd testapp
- mkdir -p startupapp && cd startupapp

# Generate the 'web' Dockerfile:
- echo "FROM ${RELEASE_IMAGE_TAG}" >> Dockerfile.web

# Generate the 'release' Dockerfile:
- echo "FROM ${RELEASE_IMAGE_TAG}" >> Dockerfile.release
- echo 'CMD [ "rails", "release" ]' >> Dockerfile.release

# Push the images to staging:
- heroku container:push --recursive --app testapp-staging
- heroku container:push --recursive --app startupapp-staging

# Release the images to staging:
- heroku container:release web release --app testapp-staging
- heroku container:release web release --app startupapp-staging

- name: Production Deploy
task:
Expand All @@ -63,21 +63,21 @@ blocks:
jobs:
- name: Main App
commands:
- export RELEASE_IMAGE_TAG=564922552600.dkr.ecr.eu-central-1.amazonaws.com/icalialabs/testapp:${GIT_SHORT_SHA:-latest}
- export RELEASE_IMAGE_TAG=978175366817.dkr.ecr.us-west-2.amazonaws.com/charlieigg/startupapp:${GIT_SHORT_SHA:-latest}

- docker pull ${RELEASE_IMAGE_TAG}

- mkdir -p testapp && cd testapp
- mkdir -p startupapp && cd startupapp

# Generate the 'web' Dockerfile:
- echo "FROM ${RELEASE_IMAGE_TAG}" >> Dockerfile.web

# Generate the 'release' Dockerfile:
- echo "FROM ${RELEASE_IMAGE_TAG}" >> Dockerfile.release
- echo 'CMD [ "rails", "release" ]' >> Dockerfile.release

# Push the images to production:
- heroku container:push --recursive --app testapp-production
- heroku container:push --recursive --app startupapp-production

# Release the images to production:
- heroku container:release web release --app testapp-production
- heroku container:release web release --app startupapp-production
20 changes: 10 additions & 10 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: v1.0

name: 'Main Pipeline'
name: "Main Pipeline"

agent:
machine:
Expand Down Expand Up @@ -31,17 +31,17 @@ blocks:
jobs:
- name: Main app
commands:
# Pull the images referenced in the 'cache_from' key:
- docker-image-manager download-cache test
# Pull the images referenced in the 'cache_from' key:
- docker-image-manager download-cache test

# Build the test image:
- ci-compose build --pull test
# Build the test image:
- ci-compose build --pull test

# Tag & Push test image so we can use it on later blocks:
- docker-image-manager tag-and-push test
# Tag & Push test image so we can use it on later blocks:
- docker-image-manager tag-and-push test

- name: "Testapp Tests"
dependencies: [ "Build Test Images" ]
- name: "Startup Evaluation App Tests"
dependencies: ["Build Test Images"]
task:
secrets:
- name: AWS
Expand Down Expand Up @@ -88,7 +88,7 @@ blocks:

- name: End-to-End Tests
dependencies:
- "Testapp Tests"
- "Startup Evaluation App Tests"
task:
jobs:
# This is just a placeholder we'll have for now:
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## How to contribute to TESTAPP
## How to contribute to STARTUPAPP

#### **Did you find a bug?**

* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/IcaliaLabs/testapp/issues).
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/charlieigg/startupapp/issues).

* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/IcaliaLabs/testapp/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. Also add a `bug` tag to it.
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/charlieigg/startupapp/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. Also add a `bug` tag to it.

#### **Are you ready to place a pull request?**

Expand All @@ -19,7 +19,7 @@

#### **Did you fix whitespace, format code, or make a purely cosmetic patch?**

For changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of TESTAPP, just add a title tag of `[COSMETIC]` and assign the code reviewer.
For changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of STARTUPAPP, just add a title tag of `[COSMETIC]` and assign the code reviewer.

#### **Do you have questions about the source code?**

Expand Down
106 changes: 53 additions & 53 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ ENV HOME=/usr/src PATH=/usr/src/bin:$PATH

# Step 6: We'll install curl for later dependencies installations
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl
apt-get install -y --no-install-recommends \
curl

# Step 7: Add nodejs source
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -

# Step 8: Add yarn packages repository
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

# Step 9: Install the common runtime dependencies:
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https software-properties-common \
ca-certificates \
libpq5 \
openssl \
nodejs \
tzdata \
yarn && \
rm -rf /var/lib/apt/lists/*
apt-get install -y --no-install-recommends \
apt-transport-https software-properties-common \
ca-certificates \
libpq5 \
openssl \
nodejs \
tzdata \
yarn && \
rm -rf /var/lib/apt/lists/*

# Step 10: Add Dockerize image
RUN export DOCKERIZE_VERSION=v0.6.1 && curl -L \
https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
| tar -C /usr/local/bin -xz
https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
| tar -C /usr/local/bin -xz

# II: Development Stage: =======================================================
# In this stage we'll build the image used for development, including compilers,
Expand All @@ -64,14 +64,14 @@ FROM runtime AS development
# Step 12: Install the development dependency packages with alpine package
# manager:
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
chromium \
chromium-driver \
git \
graphviz \
libpq-dev && \
rm -rf /var/lib/apt/lists/*
apt-get install -y --no-install-recommends \
build-essential \
chromium \
chromium-driver \
git \
graphviz \
libpq-dev && \
rm -rf /var/lib/apt/lists/*

# Step 13: Fix npm uid-number error
# - see https://github.com/npm/uid-number/issues/7
Expand Down Expand Up @@ -112,11 +112,11 @@ FROM testing AS builder

# Step 22: Precompile assets:
RUN export DATABASE_URL=postgres://[email protected]:5432/fakedb \
SECRET_KEY_BASE=10167c7f7654ed02b3557b05b88ece \
RAILS_ENV=production && \
rails assets:precompile && \
rails webpacker:compile && \
rails secret > /dev/null
SECRET_KEY_BASE=10167c7f7654ed02b3557b05b88ece \
RAILS_ENV=production && \
rails assets:precompile && \
rails webpacker:compile && \
rails secret > /dev/null

# Step 23: Remove installed gems that belong to the development & test groups -
# we'll copy the remaining system gems into the deployable image on the next
Expand All @@ -125,21 +125,21 @@ RUN bundle config without development:test && bundle clean

# Step 24: Remove files not used on release image:
RUN rm -rf \
.rspec \
Guardfile \
bin/rspec \
bin/checkdb \
bin/dumpdb \
bin/restoredb \
bin/setup \
bin/spring \
bin/update \
bin/dev-entrypoint.sh \
config/spring.rb \
node_modules \
spec \
config/initializers/listen_patch.rb \
tmp/*
.rspec \
Guardfile \
bin/rspec \
bin/checkdb \
bin/dumpdb \
bin/restoredb \
bin/setup \
bin/spring \
bin/update \
bin/dev-entrypoint.sh \
config/spring.rb \
node_modules \
spec \
config/initializers/listen_patch.rb \
tmp/*

# V: Release stage: ============================================================
# In this stage, we build the final, deployable Docker image, which will be
Expand All @@ -160,9 +160,9 @@ ENV RAILS_ENV=production RACK_ENV=production PORT=3000

# Step 29: Generate the temporary directories in case they don't already exist:
RUN mkdir -p /usr/src/tmp/cache && \
mkdir -p /usr/src/tmp/pids && \
mkdir -p /usr/src/tmp/sockets && \
chown -R nobody /usr/src
mkdir -p /usr/src/tmp/pids && \
mkdir -p /usr/src/tmp/sockets && \
chown -R nobody /usr/src

# Step 30: Set the container user to 'nobody':
USER nobody
Expand All @@ -174,13 +174,13 @@ CMD [ "puma" ]
ARG SOURCE_BRANCH="master"
ARG SOURCE_COMMIT="000000"
ARG BUILD_DATE="2017-09-26T16:13:26Z"
ARG IMAGE_NAME="testapp:latest"
ARG IMAGE_NAME="startupapp:latest"

LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Testapp" \
org.label-schema.description="testapp" \
org.label-schema.vcs-url="https://github.com/IcaliaLabs/testapp.git" \
org.label-schema.vcs-ref=$SOURCE_COMMIT \
org.label-schema.schema-version="1.0.0-rc1" \
build-target="release" \
build-branch=$SOURCE_BRANCH
org.label-schema.name="Startup Evaluation App" \
org.label-schema.description="startupapp" \
org.label-schema.vcs-url="https://github.com/charlieigg/startupapp.git" \
org.label-schema.vcs-ref=$SOURCE_COMMIT \
org.label-schema.schema-version="1.0.0-rc1" \
build-target="release" \
build-branch=$SOURCE_BRANCH
Loading

0 comments on commit b027192

Please sign in to comment.