Skip to content

Instantly share code, notes, and snippets.

@robacarp
Last active February 21, 2019 22:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save robacarp/ce3c449a6c26652adad0a17a6cde3f18 to your computer and use it in GitHub Desktop.
Save robacarp/ce3c449a6c26652adad0a17a6cde3f18 to your computer and use it in GitHub Desktop.
FROM crystallang/crystal:0.27.2
WORKDIR /opt/src
# Install nodejs
COPY bin ./bin
RUN bin/nodesource_11.x
RUN apt-get update && apt-get install -y nodejs
# npm install
COPY package-lock.json package.json ./
RUN npm install
COPY shard.lock shard.yml ./
RUN ls -la
RUN shards install
COPY config config/
COPY db db/
COPY public public/
COPY src src/
COPY tasks tasks/
COPY Procfile tasks.cr webpack.mix.js ./
EXPOSE 3001
EXPOSE 3002
EXPOSE 5000
ENV LUCKY_ENV development
ENV DATABASE_URL postgres://docker.for.mac.localhost/database
RUN crystal build --release -o bin/server src/server.cr
ENTRYPOINT ["/bin/bash"]
CMD ["-c", "bin/server"]
@konung
Copy link

konung commented Feb 14, 2019

Thank you Robacarp!

@paulcsmith
Copy link

Very nice! A few things I'd do in production:

  • Change the command to crystal run --release src/server.cr. This will add a bunch of optimizations to speed things up. Don't do this in dev though. Compilation is WAY slower
  • You'll of course need to change LUCKY_ENV to production

@paulcsmith
Copy link

For dev I'd probably use lucky dev as the launch command. That will use a process manager to start the watch process and make sure assets are compiled live

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment