Merge branch 'dev' of github.com:CatDeployed/docker-postal into dev

This commit is contained in:
CatDeployed 2018-08-01 04:53:04 +02:00
commit 02f7d94df3
2 changed files with 59 additions and 17 deletions

View File

@ -10,17 +10,12 @@ jobs:
name: Build Postal Docker Container name: Build Postal Docker Container
command: docker build -t catdeployed/postal:latest -t catdeployed/postal:alpine . command: docker build -t catdeployed/postal:latest -t catdeployed/postal:alpine .
- run: - run:
name: Skip this job for Pull Requests name: Export Container
command: '[[ -v CIRCLE_PR_NUMBER ]] && circleci step halt || true' command: mkdir workspace && cd workspace && docker save --output postal_alpine.tar catdeployed/postal:alpine
- run: - persist_to_workspace:
name: Login to Docker Hub root: workspace
command: docker login -u $DOCKER_USER -p $DOCKER_PASS paths:
- run: - postal_alpine.tar
name: Push to Docker Hub
command: docker push catdeployed/postal:latest
- run:
name: Push to Docker Hub
command: docker push catdeployed/postal:alpine
build-ubuntu: build-ubuntu:
machine: true machine: true
working_directory: ~/repo/ubuntu working_directory: ~/repo/ubuntu
@ -31,14 +26,39 @@ jobs:
name: Build Postal Docker Container name: Build Postal Docker Container
command: docker build -t catdeployed/postal:ubuntu . command: docker build -t catdeployed/postal:ubuntu .
- run: - run:
name: Skip this job for Pull Requests name: Export Container
command: '[[ -v CIRCLE_PR_NUMBER ]] && circleci step halt || true' command: mkdir workspace && cd workspace && docker save --output postal_ubuntu.tar catdeployed/postal:ubuntu
- persist_to_workspace:
root: workspace
paths:
- postal_ubuntu.tar
deploy:
machine: true
working_directory: ~/repo/ubuntu
steps:
- attach_workspace:
at: /tmp/workspace
- run:
name: Load Alpine Image
command: docker load --input /tmp/workspace/postal_alpine.tar
- run:
name: Load Ubuntu Image
command: docker load --input /tmp/workspace/postal_ubuntu.tar
- run:
name: Tag alpine image as latest
command: docker tag catdeployed/postal:alpine catdeployed/postal:latest
- run: - run:
name: Login to Docker Hub name: Login to Docker Hub
command: docker login -u $DOCKER_USER -p $DOCKER_PASS command: docker login -u $DOCKER_USER -p $DOCKER_PASS
- run: - run:
name: Push to Docker Hub name: Push Ubuntu Container to Docker Hub
command: docker push catdeployed/postal:ubuntu command: docker push catdeployed/postal:ubuntu
- run:
name: Push Alpine Container to Docker Hub
command: docker push catdeployed/postal:alpine
- run:
name: Push Latest Container to Docker Hub
command: docker push catdeployed/postal:latest
workflows: workflows:
version: 2 version: 2
nightly: nightly:
@ -49,10 +69,32 @@ workflows:
branches: branches:
only: only:
- master - master
- dev
jobs: jobs:
- build-alpine - build-alpine
- build-ubuntu - build-ubuntu
- deploy:
requires:
- build-alpine
- build-ubuntu
filters:
branches:
only:
- master
- dev
commit: commit:
jobs: jobs:
- build-alpine - build-alpine
- build-ubuntu - build-ubuntu
- deploy:
requires:
- build-alpine
- build-ubuntu
filters:
branches:
only:
- master
- dev
notify:
webhooks:
- url: https://hooks.microbadger.com/images/catdeployed/postal/K0vCLtQnFFKukT-LuAEBmGD0cHs=

View File

@ -1,6 +1,6 @@
FROM ruby:2.4-alpine FROM ruby:2.5-alpine
RUN apk --no-cache add nodejs mariadb-client git bash python2 libcap py-setuptools py-pip build-base python-dev mariadb-dev tzdata \ RUN apk --no-cache add nodejs mariadb-client git bash python2 libcap py-setuptools py-pip build-base mariadb-dev tzdata mariadb-client-libs \
&& pip install j2cli \ && pip install j2cli \
&& git clone https://github.com/atech/postal.git /opt/postal \ && git clone https://github.com/atech/postal.git /opt/postal \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
@ -11,7 +11,7 @@ RUN apk --no-cache add nodejs mariadb-client git bash python2 libcap py-setuptoo
&& adduser -S -G postal -h /opt/postal -s /bin/bash postal \ && adduser -S -G postal -h /opt/postal -s /bin/bash postal \
&& chown -R postal:postal /opt/postal/ \ && chown -R postal:postal /opt/postal/ \
&& /opt/postal/bin/postal bundle /opt/postal/vendor/bundle \ && /opt/postal/bin/postal bundle /opt/postal/vendor/bundle \
&& apk del mariadb-dev git \ && apk del git mariadb-dev \
&& rm -rf /var/cache/apk/* && rm -rf /var/cache/apk/*
## Adjust permissions ## Adjust permissions