Update docker images

* Use go 1.16
* Use debian buster for dependencies
This commit is contained in:
Cyrill Troxler 2021-04-05 12:46:05 +02:00
parent cf4e84ba5e
commit 0bc0af5d8b
2 changed files with 21 additions and 5 deletions

View file

@ -1,4 +1,12 @@
FROM debian:stretch FROM golang:1.16-alpine as gobuild
WORKDIR /build
ADD . /build
RUN go get -d -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ./s3driver ./cmd/s3driver
FROM debian:buster-slim
LABEL maintainers="Cyrill Troxler <cyrilltroxler@gmail.com>" LABEL maintainers="Cyrill Troxler <cyrilltroxler@gmail.com>"
LABEL description="csi-s3 slim image" LABEL description="csi-s3 slim image"
@ -16,5 +24,5 @@ RUN cd /tmp \
&& mv /tmp/rclone-*-linux-amd64/rclone /usr/bin \ && mv /tmp/rclone-*-linux-amd64/rclone /usr/bin \
&& rm -r /tmp/rclone* && rm -r /tmp/rclone*
COPY ./_output/s3driver /s3driver COPY --from=gobuild /build/s3driver /s3driver
ENTRYPOINT ["/s3driver"] ENTRYPOINT ["/s3driver"]

View file

@ -1,4 +1,12 @@
FROM debian:stretch as s3backer FROM golang:1.16-alpine as gobuild
WORKDIR /build
ADD . /build
RUN go get -d -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o ./s3driver ./cmd/s3driver
FROM debian:buster-slim as s3backer
ARG S3BACKER_VERSION=1.5.0 ARG S3BACKER_VERSION=1.5.0
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
@ -24,7 +32,7 @@ RUN ./autogen.sh && \
make && \ make && \
make install make install
FROM debian:stretch FROM debian:buster-slim
LABEL maintainers="Cyrill Troxler <cyrilltroxler@gmail.com>" LABEL maintainers="Cyrill Troxler <cyrilltroxler@gmail.com>"
LABEL description="csi-s3 image" LABEL description="csi-s3 image"
COPY --from=s3backer /usr/bin/s3backer /usr/bin/s3backer COPY --from=s3backer /usr/bin/s3backer /usr/bin/s3backer
@ -44,5 +52,5 @@ RUN cd /tmp \
&& mv /tmp/rclone-*-linux-amd64/rclone /usr/bin \ && mv /tmp/rclone-*-linux-amd64/rclone /usr/bin \
&& rm -r /tmp/rclone* && rm -r /tmp/rclone*
COPY ./_output/s3driver /s3driver COPY --from=gobuild /build/s3driver /s3driver
ENTRYPOINT ["/s3driver"] ENTRYPOINT ["/s3driver"]