From 9a1785d01750c81d7d5cb533c6f08d0a56749493 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sun, 4 Nov 2018 17:21:45 +1300 Subject: [PATCH] Add Gitlab CI config and Dockerfile --- .dockerignore | 1 + .gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000..84c048a73cc2e --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +/build/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000..2ff7e7cf573b7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,29 @@ + image: docker:stable + + variables: + # When using dind service we need to instruct docker, to talk with the + # daemon started inside of the service. The daemon is available with + # a network connection instead of the default /var/run/docker.sock socket. + # + # The 'docker' hostname is the alias of the service container as described at + # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services + # + # Note that if you're using Kubernetes executor, the variable should be set to + # tcp://localhost:2375 because of how Kubernetes executor connects services + # to the job container + DOCKER_HOST: tcp://docker:2375/ + # When using dind, it's wise to use the overlayfs driver for + # improved performance. + DOCKER_DRIVER: overlay2 + + services: + - docker:dind + + before_script: + - docker info + + build: + stage: build + script: + - docker build -t avr-rust . + - docker run avr-rust echo hello world diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000..f8b3a6d28d1fa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:18.04 + +USER root + +# Install dependencies. +RUN apt-get update && apt-get install -y build-essential cmake curl git python + +# Create a regular user. +RUN useradd -m rustacean + +# Copy the code over, create an empty directory for builds. +ADD . /code +# RUN cd /code +RUN mkdir /build && cd /build + +# symlink Rust build directory to the /build volume +# RUN mkdir /build && ln -sf /build /code/build + +# Compile rust. +# RUN /code/x.py build + +# Generate Makefile using settings suitable for an experimental compiler +RUN /code/configure \ + --enable-debug \ + --disable-docs \ + --enable-llvm-assertions \ + --enable-debug-assertions \ + --enable-optimize \ + --enable-llvm-release-debuginfo \ + --experimental-targets=AVR + +RUN make +RUN make install + +# Drop down to the regular user +USER rustacean + +VOLUME /code +VOLUME /build