Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ci): remove .git and sources from final image, build one alpine version #213

Merged
merged 1 commit into from
Nov 18, 2020
Merged
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
5 changes: 0 additions & 5 deletions .github/workflows/release-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
matrix:
flavour:
- ubuntu
- alpine3.11
- alpine3.12
runs-on: [ubuntu-latest]
env:
Expand Down Expand Up @@ -46,10 +45,6 @@ jobs:
fi

case $FLAVOUR in
alpine3.11)
dockerFile="Dockerfile-alpine3.11"
imageTag=${imageTag}-alpine3.11
;;
alpine3.12)
dockerFile="Dockerfile-alpine3.12"
imageTag=${imageTag}-alpine3.12
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ RUN apt-get update && \


# build shell-operator binary
FROM golang:1.12 AS shell-operator
FROM golang:1.15 AS shell-operator
ARG appVersion=latest

# Cache-friendly download of go dependencies.
ADD go.mod go.sum /src/shell-operator/
WORKDIR /src/shell-operator
ADD go.mod go.sum /app/
WORKDIR /app
RUN go mod download

COPY --from=libjq /libjq /libjq
ADD . /src/shell-operator
ADD . /app

RUN CGO_ENABLED=1 \
CGO_CFLAGS="-I/libjq/include" \
Expand All @@ -41,13 +41,14 @@ FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y ca-certificates wget jq && \
rm -rf /var/lib/apt/lists && \
wget https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl -O /bin/kubectl && \
wget https://storage.googleapis.com/kubernetes-release/release/v1.19.4/bin/linux/amd64/kubectl -O /bin/kubectl && \
chmod +x /bin/kubectl && \
rm -rf /var/lib/apt/lists/* && \
mkdir /hooks
ADD frameworks /
ADD shell_lib.sh /
COPY --from=tini /usr/local/bin/tini /sbin/tini
COPY --from=shell-operator /src/shell-operator /
COPY --from=shell-operator /app/shell-operator /
WORKDIR /
ENV SHELL_OPERATOR_HOOKS_DIR /hooks
ENV LOG_TYPE json
Expand Down
46 changes: 0 additions & 46 deletions Dockerfile-alpine3.11

This file was deleted.

10 changes: 5 additions & 5 deletions Dockerfile-alpine3.12
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ ARG appVersion=latest
RUN apk --no-cache add git ca-certificates gcc libc-dev

# Cache-friendly download of go dependencies.
ADD go.mod go.sum /src/shell-operator/
WORKDIR /src/shell-operator
ADD go.mod go.sum /app/
WORKDIR /app
RUN go mod download

COPY --from=libjq /libjq /libjq
ADD . /src/shell-operator
ADD . /app

RUN CGO_ENABLED=1 \
CGO_CFLAGS="-I/libjq/include" \
Expand All @@ -33,12 +33,12 @@ RUN CGO_ENABLED=1 \
# build final image
FROM alpine:3.12
RUN apk --no-cache add ca-certificates jq bash sed tini && \
wget https://storage.googleapis.com/kubernetes-release/release/v1.19.0/bin/linux/amd64/kubectl -O /bin/kubectl && \
wget https://storage.googleapis.com/kubernetes-release/release/v1.19.4/bin/linux/amd64/kubectl -O /bin/kubectl && \
chmod +x /bin/kubectl && \
mkdir /hooks
ADD frameworks /
ADD shell_lib.sh /
COPY --from=shell-operator /src/shell-operator /
COPY --from=shell-operator /app/shell-operator /
WORKDIR /
ENV SHELL_OPERATOR_HOOKS_DIR /hooks
ENV LOG_TYPE json
Expand Down