Last active
May 5, 2020 12:35
-
-
Save skojin/7b78494eb35f238af7216d70f615603e to your computer and use it in GitHub Desktop.
Dockerfile for http://luckyframework.org deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM crystallang/crystal:0.34.0 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_12.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 to different directory to have separate layer cache with shards | |
COPY yarn.lock package.json /tmp/ | |
RUN cd /tmp && yarn install --frozen-lockfile && mv /tmp/node_modules /src/ | |
COPY . . | |
# instead of "RUN yarn prod", that uses package.json to "npm run prod", do it without progress | |
RUN NODE_ENV=production yarn run webpack --hide-modules --color --config=node_modules/laravel-mix/setup/webpack.config.js | |
RUN crystal build --release src/start_server.cr -o ./server | |
FROM crystallang/crystal:0.34.0 | |
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