Skip to content

Commit

Permalink
Moving docker builds back to rust-slim and changed the tag format. (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesdejager authored May 8, 2020
1 parent a201ee6 commit 953fa4a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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=%)
Expand Down Expand Up @@ -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-%
Expand All @@ -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
9 changes: 6 additions & 3 deletions alpine-debug.Dockerfile.template
Original file line number Diff line number Diff line change
@@ -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

Expand Down
21 changes: 6 additions & 15 deletions alpine.Dockerfile.template
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 953fa4a

Please sign in to comment.