Created
July 7, 2019 01:37
-
-
Save mwlang/258ccb37ad284c2ad0a60c33c0dabcd6 to your computer and use it in GitHub Desktop.
Docker files for bringing up a LuckyFramework app ... Some of this is redundant.
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
.git | |
.dockerignore | |
bin/ | |
lib/ | |
spec/ |
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
LUCKY_ENV=production | |
SECRET_KEY_BASE=p9o8Sy1+t3JPuAck9Zc/U9N7fK+KzIjxZWhGlwxdGl4= | |
DATABASE_URL=postgres://lucky:developer@db:5432/maestro_production | |
DB_NAME=maestro_production | |
DB_HOST=db | |
DB_USERNAME=lucky | |
DB_PASSWORD=developer | |
APP_DOMAIN=example.com | |
PORT=5000 |
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
version: '3' | |
services: | |
db: | |
container_name: maestro_db | |
image: postgres:11.3 | |
environment: | |
- POSTGRES_DB=maestro_production | |
- POSTGRES_USER=lucky | |
- POSTGRES_PASSWORD=developer | |
networks: | |
- internal | |
ports: | |
- 5432:5432 | |
volumes: | |
- data:/var/lib/postgresql/data | |
app: | |
build: . | |
container_name: maestro_app | |
command: ["lucky", "db.migrate", "&&", "/app/bin/maestro"] | |
environment: | |
- LUCKY_ENV=production | |
- SECRET_KEY_BASE=p9o8Sy1+t3JPuAck9Zc/U9N7fK+KzIjxZWhGlwxdGl4= | |
- DATABASE_URL=postgres://lucky:developer@db:5432/maestro_production | |
- DB_NAME=maestro_production | |
- DB_HOST=db | |
- DB_USERNAME=lucky | |
- DB_PASSWORD=developer | |
- APP_DOMAIN=example.com | |
- PORT=5000 | |
networks: | |
- internal | |
ports: | |
- 5000:5000 | |
links: | |
- db | |
depends_on: | |
- db | |
volumes: | |
data: | |
nodes: | |
shards: | |
networks: | |
internal: |
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.29.0 as system | |
RUN apt-get update && \ | |
apt-get install -y libnss3 libgconf-2-4 chromium-browser build-essential curl libreadline-dev libevent-dev libssl-dev libxml2-dev libyaml-dev libgmp-dev git golang-go postgresql postgresql-contrib locales && \ | |
# Set up node and yarn | |
curl --silent --location https://deb.nodesource.com/setup_11.x | bash - && \ | |
apt-get install -y nodejs && \ | |
npm install -g yarn && \ | |
# Lucky cli | |
git clone https://github.com/luckyframework/lucky_cli --branch master --depth 1 /usr/local/lucky_cli && \ | |
cd /usr/local/lucky_cli && \ | |
shards install && \ | |
crystal build src/lucky.cr -o /usr/local/bin/lucky && \ | |
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
FROM system as shard-dependencies | |
WORKDIR /app | |
COPY shard* /app/ | |
RUN shards install | |
FROM shard-dependencies as assets-pipeline | |
WORKDIR /app | |
COPY package.json . | |
COPY webpack* . | |
COPY src/js/ ./src/js/ | |
COPY src/css/ ./src/css/ | |
RUN yarn install | |
RUN yarn prod | |
RUN rm -rf /app/node_modules | |
FROM assets-pipeline as build | |
WORKDIR /app | |
COPY . /app | |
RUN shards build --production | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment