Skip to content

Commit

Permalink
Add Gitlab CI config and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanmckay committed Jun 9, 2019
1 parent 311d956 commit 9a1785d
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
29 changes: 29 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9a1785d

Please sign in to comment.