Skip to content

Instantly share code, notes, and snippets.

@Daniel-Worrall
Created August 10, 2019 21:19
Show Gist options
  • Save Daniel-Worrall/193a1a957234efe6dc13813cb61397fc to your computer and use it in GitHub Desktop.
Save Daniel-Worrall/193a1a957234efe6dc13813cb61397fc to your computer and use it in GitHub Desktop.
FROM ubuntu:18.10
RUN apt-get update && apt-get install -y \
libbsd-dev \
libedit-dev \
libevent-dev \
libgc-dev \
libgmp-dev \
libgmpxx4ldbl \
libssl-dev \
libxml2-dev \
libyaml-dev \
libreadline-dev \
automake \
libtool \
git \
llvm \
llvm-dev \
libpcre3-dev \
build-essential \
libz-dev \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 https://github.com/crystal-lang/crystal.git
RUN cd crystal && make deps
COPY . /project/
RUN cc '/project/appname.o' -o '/project/appname' -rdynamic -lz `command -v pkg-config > /dev/null && pkg-config -/libgc.a -lpthread /crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/bin/../lib/crystal/lib -L/usr/lib -L/usr/local/lib
FROM crystal-ubuntu
WORKDIR /project
COPY shard.yml shard.lock ./
RUN shards install --production
COPY src src
RUN shards build --release --production --cross-compile --target=arm-unknown-linux-gnueabihf
FROM ubuntu:18.10
RUN apt-get update && \
apt-get install -y curl gnupg && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN curl -sL "https://keybase.io/crystal/pgp_keys.asc" | apt-key add - \
&& echo "deb https://dist.crystal-lang.org/apt crystal main" | tee /etc/apt/sources.list.d/crystal.list \
&& apt-get update && apt-get install -y \
crystal \
libbsd-dev \
libedit-dev \
libevent-dev \
libgc-dev \
libgmp-dev \
libgmpxx4ldbl \
libssl-dev \
libxml2-dev \
libyaml-dev \
libz-dev \
libreadline-dev \
automake \
libtool \
git \
llvm \
llvm-dev \
libpcre3-dev \
build-essential \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN git clone --branch 0.30.0 --depth 1 https://github.com/crystal-lang/crystal.git
RUN cd crystal && make clean crystal release=1
RUN mv /crystal/.build/crystal /usr/lib/crystal/bin/crystal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment