mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 07:30:13 +01:00
Merge pull request #622 from vsoch/test/shorter-docker-builds
Building akin to azure-pipelines to shorten CircleCI builds
This commit is contained in:
commit
4ce6a9c9f7
@ -9,15 +9,6 @@ version: 2.1
|
|||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
|
||||||
check_token:
|
|
||||||
description: Check that QUAY_TOKEN is provided in environment
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
if [[ -z "${QUAY_TOKEN}" ]]; then
|
|
||||||
echo "QUAY_TOKEN is undefined. Add to CircleCI environment to continue."
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
pull_cache:
|
pull_cache:
|
||||||
description: Pulls Quay.io docker images usable for our cache
|
description: Pulls Quay.io docker images usable for our cache
|
||||||
steps:
|
steps:
|
||||||
@ -46,7 +37,6 @@ workflows:
|
|||||||
ignore:
|
ignore:
|
||||||
- master
|
- master
|
||||||
before_build:
|
before_build:
|
||||||
- check_token
|
|
||||||
- pull_cache
|
- pull_cache
|
||||||
after_build:
|
after_build:
|
||||||
- run:
|
- run:
|
||||||
@ -76,7 +66,6 @@ workflows:
|
|||||||
tags:
|
tags:
|
||||||
only: /^v.*/
|
only: /^v.*/
|
||||||
before_build:
|
before_build:
|
||||||
- check_token
|
|
||||||
- pull_cache
|
- pull_cache
|
||||||
after_build:
|
after_build:
|
||||||
- run:
|
- run:
|
||||||
@ -90,7 +79,6 @@ workflows:
|
|||||||
echo "Version for Docker tag is ${DOCKER_TAG}"
|
echo "Version for Docker tag is ${DOCKER_TAG}"
|
||||||
docker tag quay.io/nushell/nu-base:latest quay.io/nushell/nu-base:${DOCKER_TAG}
|
docker tag quay.io/nushell/nu-base:latest quay.io/nushell/nu-base:${DOCKER_TAG}
|
||||||
docker tag quay.io/nushell/nu:latest quay.io/nushell/nu:${DOCKER_TAG}
|
docker tag quay.io/nushell/nu:latest quay.io/nushell/nu:${DOCKER_TAG}
|
||||||
docker login -u="nushell+circleci" -p="${QUAY_TOKEN}" quay.io
|
|
||||||
docker push quay.io/nushell/nu-base
|
docker push quay.io/nushell/nu-base
|
||||||
docker push quay.io/nushell/nu
|
docker push quay.io/nushell/nu
|
||||||
|
|
||||||
@ -105,9 +93,8 @@ workflows:
|
|||||||
registry: quay.io
|
registry: quay.io
|
||||||
tag: devel
|
tag: devel
|
||||||
dockerfile: docker/Dockerfile.nu-base
|
dockerfile: docker/Dockerfile.nu-base
|
||||||
extra_build_args: --cache-from=quay.io/nushell/nu-base:latest,quay.io/nushell/nu:latest
|
extra_build_args: --cache-from=quay.io/nushell/nu-base:latest,quay.io/nushell/nu:latest --build-arg RELEASE=true
|
||||||
before_build:
|
before_build:
|
||||||
- check_token
|
|
||||||
- pull_cache
|
- pull_cache
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
@ -120,6 +107,5 @@ workflows:
|
|||||||
- run:
|
- run:
|
||||||
name: Publish Development Docker Tags
|
name: Publish Development Docker Tags
|
||||||
command: |
|
command: |
|
||||||
docker login -u="nushell+circleci" -p="${QUAY_TOKEN}" quay.io
|
|
||||||
docker push quay.io/nushell/nu-base:devel
|
docker push quay.io/nushell/nu-base:devel
|
||||||
docker push quay.io/nushell/nu:devel
|
docker push quay.io/nushell/nu:devel
|
||||||
|
@ -3,3 +3,4 @@ FROM quay.io/nushell/nu-base:${FROMTAG} as base
|
|||||||
FROM rust:1.37-slim
|
FROM rust:1.37-slim
|
||||||
COPY --from=base /usr/local/bin/nu /usr/local/bin/nu
|
COPY --from=base /usr/local/bin/nu /usr/local/bin/nu
|
||||||
ENTRYPOINT ["nu"]
|
ENTRYPOINT ["nu"]
|
||||||
|
CMD ["-l", "info"]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM rust:1.37-slim
|
FROM ubuntu:16.04
|
||||||
|
|
||||||
# docker build -f docker/Dockerfile.nu-base -t nushell/nu-base .
|
# docker build -f docker/Dockerfile.nu-base -t nushell/nu-base .
|
||||||
# docker run -it nushell/nu-base
|
# docker run -it nushell/nu-base
|
||||||
@ -7,12 +7,20 @@ ENV DEBIAN_FRONTEND noninteractive
|
|||||||
RUN apt-get update && apt-get install -y libssl-dev \
|
RUN apt-get update && apt-get install -y libssl-dev \
|
||||||
libxcb-composite0-dev \
|
libxcb-composite0-dev \
|
||||||
libx11-dev \
|
libx11-dev \
|
||||||
pkg-config
|
pkg-config \
|
||||||
|
curl
|
||||||
RUN USER=root cargo new --bin /code
|
|
||||||
|
|
||||||
|
ARG RELEASE=false
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
ADD . /code
|
COPY ./rust-toolchain ./rust-toolchain
|
||||||
RUN cargo build --release && cargo run --release
|
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path --default-toolchain `cat rust-toolchain`
|
||||||
RUN cp target/release/nu /usr/local/bin
|
ENV PATH=/root/.cargo/bin:$PATH
|
||||||
|
COPY . /code
|
||||||
|
RUN echo "##vso[task.prependpath]/root/.cargo/bin" && \
|
||||||
|
rustc -Vv && \
|
||||||
|
if $RELEASE; then cargo build --release && cargo run --release; \
|
||||||
|
cp target/release/nu /usr/local/bin; \
|
||||||
|
else cargo build; \
|
||||||
|
cp target/debug/nu /usr/local/bin; fi;
|
||||||
ENTRYPOINT ["nu"]
|
ENTRYPOINT ["nu"]
|
||||||
|
CMD ["-l", "info"]
|
||||||
|
Loading…
Reference in New Issue
Block a user