Skip to content

Commit 266a8d6

Browse files
leonspreevejd
authored andcommitted
[0.3.2][] - 2017-12-20
- Made plugins fail with non-zero status for backup errors - Bumped Python from `2.7.13` to `2.7.14` - Switched to modern multi-stage build process
1 parent d2150c5 commit 266a8d6

File tree

11 files changed

+93
-134
lines changed

11 files changed

+93
-134
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
export REGISTRY_HOST="bigdatauniversity/"
44
export REPO="bigdatauniversity/portals.gamora"
55

6-
export PIP_REPO_HOST=""
76
export PIP_REPO_USERNAME=""
87
export PIP_REPO_PASSWORD=""
8+
export PIP_REPO_HOST_WITH_CREDS="https://${PIP_REPO_USERNAME:?}:${PIP_REPO_PASSWORD:?}@na.artifactory.swg-devops.com/artifactory/api/pypi/apset-pypi-local/simple"
99

1010
export BACKUP_LOCAL_PATHS="/etc /var"
1111

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: bash
22
services: docker
33
env:
4-
secure: '09SaplMYjic0hl8paSF/OQO6CS1AA8alhaePsJsS0uIA3Lp8CMoXd6enZFtjrKzHNhue4xZhEkCtpVyvS4Hnfd4oimti18ZWEMgrMrHWnJmv+dDXWj5ElsNsQ8mSlZ3Aw090J5Rfy+zSuokL0gAtaYG1CJw2++BE1lvN4wJjXaOz0X+I+5sSWIjjHPYoGHwSJ1LrCgMK877siLQs1931quZLjx3D1iqy0/BRN5Luca4tCBpKaon34YzYBBDzhwlWtCryfyVbZjKGmucD0eT7NtH8Z3UuB1esHijVxnSWg9YuaB0Ntsqwrk1hSNARznaG/WLtUDV/Ov7BZPCv7ezWABqyEna8pHc139xLTytW4bXX3UT3imOZYjhk5+Anm8Pg88dis7O+YjbJ0jR8ROQRyqOVs6DV4x7cJHngToQsTdIvAL4Ukuq10Km4r5u/DYmBIlG7F8YePhJ3wkW2NF0J0wTarJXh6/VoOi8f6B/6g4rOOX+3xq8WGxdxW4yiOK6zknpBVY7tVG+f9NWDblOKRF9pj+Ruga9pDkRCooTqvXyUff4/Q3xW697QeHTwE9WlBJ9JQ9pzJdY7fDEsUT0MKwDcy0rMZL8GaFHLV+KqYv9nrgxElv/BRm6rqXRqny/AlwIEDh7TQnrJec23Q9FCcnW5CjOxFgL+1vqKM1mi+CM='
4+
secure: ze2FTRga9GfaCjgbWqMDt0d+ni8JRMvyV2BXtUiocMxgmdpULhOt5grjgtyVKSdPwz7ZIh28zdDu4mooKrDlG5wjRuuAMR1Cp1UYm8cIjgyIMwGdzQWIH1G99h0/w9UUdTTahNVAZNxeFkov8zIXKhaTDuG7qhsW9Deu7hrUCyk6aRWJJo2c6hvSusMi4IYvOP5wZunEvmC6fzxxM9bQhtflke9GL0qVB7w0E4i/5gQKbnzGzeoZ6az1B0rSNnAhXoyd4AcodMoI77zXZ/ZLSijuGfpeUu4/RyMBBVKLmaD57pQADiL4EnPy0cv8iw9o3+iEjEiQr1us5nFIECL+Ok4pgeyk0O+nXzmrsTXQJcgvGoCB99fB5YRVNB5sx+6UIfi/CPLb0NAsDuioU/J6FkkYftc2RMPFcj4cUs/3Zo1UhIKZWPMsZl2eHKulgTYp0MCG9CmyzGTljebciutThGrmEGtEMqPDK+qDeb2XJ5grxAcYCWRfKi5KFYyiEEdl/kF7Qw+fLyBMvM8X02cbJBrELwArjN1cCHkQSANHYwi7i+ZwIAfOonqG1I5JSG8XclcG//XH6y4buSAbaGDxfX3NEdwYcNv5D63mh9H9ywOVP0mnxFhzacvgzg3tCgYqqdgsG860/fPsvD+dwQGuwYvTomNoZw3Kb8r2ATc53Jk=
55
addons:
66
apt:
77
packages:

CHANGELOG.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased][]
88

9-
## [0.3.3][] - 2017-12-19
10-
### Fixed
11-
- Python image `python:2.7.14-alpine3.7` is missing. Opened issue:
12-
<https://github.com/docker-library/python/issues/252>
13-
14-
## [0.3.2][] - 2017-12-19
9+
## [0.3.2][] - 2017-12-20
1510
### Fixed
1611
- Made plugins fail with non-zero status for backup errors
1712
- Bumped Python from `2.7.13` to `2.7.14`
18-
- Bumped Alpine from `3.6` to `3.7`
13+
- Switched to modern multi-stage build process
1914

2015
## [0.3.1][] - 2017-07-17
2116
### Fixed

bin/build

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,4 @@ set -e
55
# Exit immediately if a command accesses an undeclared variable
66
set -u
77

8-
ROOT_DIR="$(dirname "$(realpath "$0")")/.."
9-
GAMORA_DIR="$ROOT_DIR/gamora"
10-
11-
GAMORA_BUILD_FILE="$GAMORA_DIR/build.tgz"
12-
13-
# Print commands and their arguments as they are executed.
14-
set -x
15-
16-
# Remove GLaDOS build file, if one exists.
17-
if [ -f "$GAMORA_BUILD_FILE" ]; then rm -vf $GAMORA_BUILD_FILE; fi
18-
19-
# Prepare build image.
20-
docker-compose -f $ROOT_DIR/docker-compose.build.yaml build
21-
22-
# Prepare GLaDOS bundle.
23-
docker run --rm portal.gamora-build > $GAMORA_BUILD_FILE
24-
25-
# # Prepare distribution image.
26-
# if [ "$CI" == true ]; then
27-
# cp $ROOT_DIR/chell.env{.example,}
28-
# fi
29-
docker-compose -f $ROOT_DIR/docker-compose.yaml build
8+
docker-compose build

bin/push

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ fi
1111

1212
docker images
1313

14-
# Why was the code assuming that $REPO:$TAG exists
15-
# while $REPO:latest doesn't and not vice versa?
16-
17-
docker tag $REPO:latest $REPO:$TAG
18-
docker push $REPO:$TAG
19-
20-
echo "Updating latest tag"
21-
docker push $REPO:latest
14+
docker-compose push
2215

2316
if [ -z "$REGISTRY_HOST" ] || [[ "$REGISTRY_HOST" == *"docker.io"* ]]; then
2417
docker logout

ci/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The following commands were used to configure CI with Travis (one-time setup).
44

55
```shell
66
travis encrypt \
7-
PIP_REPO_HOST_WITH_CREDS="https://na.artifactory.swg-devops.com/artifactory/api/pypi/apset-pypi-local" \
7+
PIP_REPO_HOST_WITH_CREDS="" \
88
PIP_REPO_USERNAME="" \
99
PIP_REPO_PASSWORD="" \
1010
--add env

docker-compose.build.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

docker-compose.yaml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ services:
55
# Gamora
66
#
77
gamora:
8-
build: ./gamora
9-
image: bigdatauniversity/portal.gamora
8+
build:
9+
context: ./gamora
10+
args:
11+
- PIP_REPO_HOST_WITH_CREDS
12+
- PIP_REPO_USERNAME
13+
- PIP_REPO_PASSWORD
14+
image: bigdatauniversity/portal.gamora:$TAG
1015
environment:
11-
# development purposes only
12-
- PIP_REPO_HOST_WITH_CREDS
13-
- PIP_REPO_USERNAME
14-
- PIP_REPO_PASSWORD
15-
1616
- MYSQL_HOST=mysql
1717
- MYSQL_PORT=3306
1818
- MYSQL_USER
@@ -33,11 +33,21 @@ services:
3333
- mysql
3434
- mongo
3535

36+
latest:
37+
build:
38+
context: ./gamora
39+
args:
40+
- PIP_REPO_HOST_WITH_CREDS
41+
- PIP_REPO_USERNAME
42+
- PIP_REPO_PASSWORD
43+
image: bigdatauniversity/portal.gamora:latest
44+
command: "bash -c 'sleep 3600'"
45+
3646
##
3747
# MySQL
3848
##
3949
mysql:
40-
image: mysql:5.7.18
50+
image: mysql:5.7.20
4151
environment:
4252
- MYSQL_ROOT_PASSWORD
4353
- MYSQL_DATABASE

gamora/Dockerfile

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,62 @@
1-
# Always specify the point version
2-
FROM python:2.7.14-alpine3.6
3-
1+
#####################
2+
#####################
3+
# Stage 1: Packages
4+
#####################
5+
#####################
6+
FROM python:2.7.14-alpine3.7 as packages
7+
LABEL maintainer="[email protected]"
8+
9+
# Install database clients
10+
# Apply security patches
11+
RUN echo 'http://dl-3.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories \
12+
&& echo 'http://dl-3.alpinelinux.org/alpine/edge/main' >> /etc/apk/repositories \
13+
&& apk add --no-cache \
14+
bash \
15+
libressl \
16+
mariadb-client \
17+
mongodb-tools \
18+
postgresql
19+
20+
ARG PIP_REPO_HOST_WITH_CREDS
21+
ARG PIP_REPO_USERNAME
22+
ARG PIP_REPO_PASSWORD
23+
24+
RUN [[ -n "${PIP_REPO_HOST_WITH_CREDS:?}" ]] \
25+
&& [[ -n "${PIP_REPO_USERNAME:?}" ]] \
26+
&& [[ -n "${PIP_REPO_PASSWORD:?}" ]]
27+
28+
RUN mkdir /root/.pip
29+
30+
RUN printf "[global]\n\
31+
index-url = https://pypi.python.org/simple\n\
32+
extra-index-url = %s\n\
33+
" "$PIP_REPO_HOST_WITH_CREDS" > /root/.pip/pip.conf
34+
35+
RUN printf "[distutils]\n\
36+
index-servers = local\n\
37+
\n\
38+
[local]\n\
39+
repository:%s\n\
40+
username:%s\n\
41+
password:%s\n\
42+
" "$PIP_REPO_HOST_WITH_CREDS" "$PIP_REPO_USERNAME" "$PIP_REPO_PASSWORD" \
43+
> /root/.pypirc
44+
45+
RUN mkdir -p /gamora /gamora/pip
46+
WORKDIR /gamora
47+
48+
# install monsoon
49+
COPY ./requirements.txt ./pip
50+
RUN pip download --no-input -r ./pip/requirements.txt --dest ./pip \
51+
&& rm /root/.pypirc /root/.pip/pip.conf
52+
53+
#######################
54+
#######################
55+
# Stage 2: Actual Image
56+
#######################
57+
#######################
58+
FROM python:2.7.14-alpine3.7
59+
LABEL maintainer="[email protected]"
460

561
# Install database clients
662
# Apply security patches
@@ -12,6 +68,7 @@ RUN echo 'http://dl-3.alpinelinux.org/alpine/edge/community' >> /etc/apk/reposit
1268
mariadb-client \
1369
mongodb-tools \
1470
postgresql \
71+
tini \
1572
&& apk add --upgrade --no-cache \
1673
db \
1774
expat \
@@ -21,15 +78,17 @@ RUN echo 'http://dl-3.alpinelinux.org/alpine/edge/community' >> /etc/apk/reposit
2178
ncurses \
2279
zlib
2380

24-
VOLUME ["/backups"]
25-
26-
# ADD extracts automatically
27-
# We want the side-effect
28-
ADD build.tgz /gamora
81+
##########
82+
# Gamora
83+
##########
2984
WORKDIR /gamora
85+
COPY --from=packages /gamora .
3086

3187
COPY requirements.txt ./
3288
RUN pip install -r ./requirements.txt --find-links ./pip
3389

3490
COPY ./docker-entrypoint.sh ./entrypoint.sh
35-
CMD ["/bin/bash", "/gamora/entrypoint.sh"]
91+
92+
VOLUME ["/backups"]
93+
ENTRYPOINT ["/sbin/tini", "--"]
94+
CMD ["/gamora/entrypoint.sh"]

gamora/Dockerfile.build

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)