Skip to content

Instantly share code, notes, and snippets.

@konung
Forked from skojin/Dockerfile
Created April 6, 2019 22:45
Show Gist options
  • Save konung/9022fb484e7e924070b49eecf3c82fd2 to your computer and use it in GitHub Desktop.
Save konung/9022fb484e7e924070b49eecf3c82fd2 to your computer and use it in GitHub Desktop.
Dockerfile for http://luckyframework.org deployment
FROM crystallang/crystal:0.27.2 as builder
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential \
apt-transport-https curl ca-certificates gnupg2 apt-utils
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y nodejs
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y yarn
ENV LUCKY_ENV production
WORKDIR /src
COPY shard.* ./
RUN shards install
COPY yarn.lock package.json ./
RUN yarn install --production
COPY . .
RUN crystal build --release --static src/server.cr -o ./server
RUN yarn prod
FROM ubuntu:latest
WORKDIR /app
COPY --from=builder /src/server /app/
COPY --from=builder /src/public /app/public
ENV LUCKY_ENV=production
ENTRYPOINT ["./server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment