From 953fa4aae9aa1c0e83e9ee6b43792e37331e9b29 Mon Sep 17 00:00:00 2001 From: Hannes de Jager Date: Fri, 8 May 2020 23:39:28 +0200 Subject: [PATCH] Moving docker builds back to rust-slim and changed the tag format. (#45) --- Makefile | 8 ++++++-- alpine-debug.Dockerfile.template | 9 ++++++--- alpine.Dockerfile.template | 21 ++++++--------------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 4fd8c24..9aea330 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -RUST_VERSION=stable +RUST_VERSION=1.43.1 DOCKER_TAG=$(shell git describe --tags) DOCKER_TEMPLATES:=$(wildcard *.Dockerfile.template) DOCKER_FILES=$(DOCKER_TEMPLATES:%.template=%) @@ -34,7 +34,7 @@ help: # Show available `make` commands .PHONY: docker-% docker-image-%: %.Dockerfile # Build the % docker image cargo clean - docker build -t bolcom/unftp:$*-$(DOCKER_TAG) -f $< . + docker build -t bolcom/unftp:$(DOCKER_TAG)-$* -f $< . ## .PHONY: docker-run-% @@ -53,3 +53,7 @@ pr-prep: # Runs checks to ensure you're ready for a pull request cargo build --verbose --all --features rest_auth,jsonfile_auth,cloud_storage cargo test --verbose --all --features rest_auth,jsonfile_auth,cloud_storage cargo doc --all-features --no-deps + +clean: + cargo clean + rm *.Dockerfile diff --git a/alpine-debug.Dockerfile.template b/alpine-debug.Dockerfile.template index 4d5f1e1..9ac61d5 100644 --- a/alpine-debug.Dockerfile.template +++ b/alpine-debug.Dockerfile.template @@ -1,9 +1,12 @@ -# we switched to muslrust from rust:slim because it has built-in support for static compilation of libssl -FROM clux/muslrust:%%RUST_VERSION%% AS builder +FROM rust:%%RUST_VERSION%%-slim AS builder WORKDIR /usr/src/unftp COPY . . +RUN apt-get update && apt-get install -y \ + musl-dev \ + musl-tools +RUN rustup target add x86_64-unknown-linux-musl ENV RUSTFLAGS="-C target-feature=+crt-static" -RUN BUILD_VERSION="%%BUILD_VERSION%%" cargo build --no-default-features --features docker +RUN BUILD_VERSION="%%BUILD_VERSION%%" cargo build --no-default-features --features docker --target=x86_64-unknown-linux-musl FROM alpine:latest diff --git a/alpine.Dockerfile.template b/alpine.Dockerfile.template index b2f8603..9fe6936 100644 --- a/alpine.Dockerfile.template +++ b/alpine.Dockerfile.template @@ -1,21 +1,12 @@ -# we switched to muslrust from rust:slim because it has built-in support for static compilation of libssl -#FROM rust:%%RUST_VERSION%%-slim AS builder -#WORKDIR /usr/src/unftp -#COPY . . -#RUN apt-get update && apt-get install -y \ -# musl-dev \ -# musl-tools -#RUN rustup target add x86_64-unknown-linux-musl -#ENV RUSTFLAGS="-C target-feature=+crt-static" -#RUN BUILD_VERSION="%%BUILD_VERSION%%" cargo build --no-default-features --features docker --release --target=x86_64-unknown-linux-musl - - -FROM clux/muslrust:%%RUST_VERSION%% AS builder +FROM rust:%%RUST_VERSION%%-slim AS builder WORKDIR /usr/src/unftp COPY . . +RUN apt-get update && apt-get install -y \ + musl-dev \ + musl-tools +RUN rustup target add x86_64-unknown-linux-musl ENV RUSTFLAGS="-C target-feature=+crt-static" -RUN BUILD_VERSION="%%BUILD_VERSION%%" cargo build --no-default-features --features docker --release - +RUN BUILD_VERSION="%%BUILD_VERSION%%" cargo build --no-default-features --features docker --release --target=x86_64-unknown-linux-musl FROM alpine:latest