Last active
February 21, 2019 22:44
-
-
Save robacarp/ce3c449a6c26652adad0a17a6cde3f18 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.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"] |
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
toproduction
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
Thank you Robacarp!