Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
variables:
DEFAULT_DOCKER_FILE: "Dockerfile.amazon2"

stages:
- build

build-n-push-latest:
stage: build
image: docker:stable
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH/kubes:latest -f $DEFAULT_DOCKER_FILE .
- docker push $CI_REGISTRY/$CI_PROJECT_PATH/kubes:latest

build-n-push-version:
stage: build
image: docker:stable
rules:
- if: $CI_COMMIT_TAG =~ /[v][0-9]+[.][0-9]+[.][0-9]+/
services:
- docker:dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH/kubes:CI_COMMIT_TAG -f $DEFAULT_DOCKER_FILE .
- docker push $CI_REGISTRY/$CI_PROJECT_PATH/kubes:$CI_COMMIT_TAG
37 changes: 37 additions & 0 deletions Dockerfile.amazon2
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM amazonlinux:2

# This Dockerfile is much lighter but won't work with gke whitelisting. Getting this error when the google gke sdk is called:
#
# Error loading shared library ld-linux-x86-64.so.2: No such file or directory #986
#
# If you don't need gke whitelisting, then this image should work and is lighter.

ENV AWS_DEFAULT_REGION "us-east-1"

# https://github.com/sgerrand/alpine-pkg-glibc/releases
ENV KUBERNETES_VER=1.19.0

RUN amazon-linux-extras install ruby3.0 -y \
&& amazon-linux-extras install python3.8 -y \
&& amazon-linux-extras install docker -y

RUN yum -y install curl wget jq unzip gcc ruby-devel make libxml

RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install

RUN wget https://storage.googleapis.com/kubernetes-release/release/v${KUBERNETES_VER}/bin/linux/amd64/kubectl
RUN chmod u+x kubectl && mv kubectl /bin/kubectl

WORKDIR /app
ADD . /app
RUN bundle install
RUN rake install

RUN yum -y remove wget jq unzip gcc ruby-devel make
RUN yum -y autoremove
RUN yum clean all && rm -rf /var/cache/yum


ENTRYPOINT ["/usr/local/bundle/bin/kubes"]