Last active
September 17, 2018 11:46
-
-
Save zackferrofields/513eed1a915e2fa9096b6810c7c4d99f to your computer and use it in GitHub Desktop.
Cache a docker base image for faster Travis builds #Docker #Travis #cache
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM zackferrofields/app:base as builder | |
COPY . . | |
RUN yarn \ | |
&& yarn build | |
FROM nginx | |
COPY nginx/conf.d/ /etc/nginx/conf.d/ | |
COPY nginx/default.d/dashboard.conf /etc/nginx/default.d/ | |
COPY nginx/data/www /var/www/zackferrofields | |
COPY --from=builder /src/public /var/www/zackferrofields/app/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:8.11.1-alpine | |
ENV WORKDIR /src | |
WORKDIR $WORKDIR | |
COPY package.json yarn.lock ./ | |
RUN yarn install |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: node_js | |
node_js: '8' | |
env: | |
global: | |
- AWS_REGION=us-west-2 | |
- IMAGE_NAME=zackferrofields/app | |
- IMAGE_BASE_TAG=base | |
- NODE_ENV=production | |
branches: | |
only: | |
- master | |
- develop | |
- /^release(\/.*)?$/ | |
services: | |
- docker | |
before_install: | |
- pip install --user awscli | |
- aws configure set region $AWS_REGION | |
- eval $(aws ecr get-login --no-include-email) | |
install: | |
- | | |
if git diff --name-only HEAD~1 | egrep -wq 'package.json|Dockerfile.base'; then | |
docker build -t $IMAGE_NAME:$IMAGE_BASE_TAG -f Dockerfile.base . | |
docker push $IMAGE_NAME:$IMAGE_BASE_TAG | |
fi | |
- docker build | |
script: echo "test go here..." | |
deploy: | |
- provider: script | |
script: deploy.sh | |
skip_cleanup: true | |
on: | |
all_branches: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment