Skip to content

Commit 9c5f0a6

Browse files
authored
Merge pull request #213 from flant/fix_build
fix(ci): remove .git and sources from final image, build one alpine version
2 parents 66231aa + 6341bbc commit 9c5f0a6

File tree

4 files changed

+12
-62
lines changed

4 files changed

+12
-62
lines changed

.github/workflows/release-build.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
matrix:
1818
flavour:
1919
- ubuntu
20-
- alpine3.11
2120
- alpine3.12
2221
runs-on: [ubuntu-latest]
2322
env:
@@ -46,10 +45,6 @@ jobs:
4645
fi
4746
4847
case $FLAVOUR in
49-
alpine3.11)
50-
dockerFile="Dockerfile-alpine3.11"
51-
imageTag=${imageTag}-alpine3.11
52-
;;
5348
alpine3.12)
5449
dockerFile="Dockerfile-alpine3.12"
5550
imageTag=${imageTag}-alpine3.12

Dockerfile

+7-6
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ RUN apt-get update && \
1515

1616

1717
# build shell-operator binary
18-
FROM golang:1.12 AS shell-operator
18+
FROM golang:1.15 AS shell-operator
1919
ARG appVersion=latest
2020

2121
# Cache-friendly download of go dependencies.
22-
ADD go.mod go.sum /src/shell-operator/
23-
WORKDIR /src/shell-operator
22+
ADD go.mod go.sum /app/
23+
WORKDIR /app
2424
RUN go mod download
2525

2626
COPY --from=libjq /libjq /libjq
27-
ADD . /src/shell-operator
27+
ADD . /app
2828

2929
RUN CGO_ENABLED=1 \
3030
CGO_CFLAGS="-I/libjq/include" \
@@ -41,13 +41,14 @@ FROM ubuntu:18.04
4141
RUN apt-get update && \
4242
apt-get install -y ca-certificates wget jq && \
4343
rm -rf /var/lib/apt/lists && \
44-
wget https://storage.googleapis.com/kubernetes-release/release/v1.17.4/bin/linux/amd64/kubectl -O /bin/kubectl && \
44+
wget https://storage.googleapis.com/kubernetes-release/release/v1.19.4/bin/linux/amd64/kubectl -O /bin/kubectl && \
4545
chmod +x /bin/kubectl && \
46+
rm -rf /var/lib/apt/lists/* && \
4647
mkdir /hooks
4748
ADD frameworks /
4849
ADD shell_lib.sh /
4950
COPY --from=tini /usr/local/bin/tini /sbin/tini
50-
COPY --from=shell-operator /src/shell-operator /
51+
COPY --from=shell-operator /app/shell-operator /
5152
WORKDIR /
5253
ENV SHELL_OPERATOR_HOOKS_DIR /hooks
5354
ENV LOG_TYPE json

Dockerfile-alpine3.11

-46
This file was deleted.

Dockerfile-alpine3.12

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ ARG appVersion=latest
1414
RUN apk --no-cache add git ca-certificates gcc libc-dev
1515

1616
# Cache-friendly download of go dependencies.
17-
ADD go.mod go.sum /src/shell-operator/
18-
WORKDIR /src/shell-operator
17+
ADD go.mod go.sum /app/
18+
WORKDIR /app
1919
RUN go mod download
2020

2121
COPY --from=libjq /libjq /libjq
22-
ADD . /src/shell-operator
22+
ADD . /app
2323

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

0 commit comments

Comments
 (0)