Skip to content

Instantly share code, notes, and snippets.

@mwlang
Last active July 6, 2019 21:02
Show Gist options
  • Select an option

  • Save mwlang/3031762925ebb69b9c797cd5cb779372 to your computer and use it in GitHub Desktop.

Select an option

Save mwlang/3031762925ebb69b9c797cd5cb779372 to your computer and use it in GitHub Desktop.
>> docker-compose up --build
Building migrator
Step 1/19 : FROM crystallang/crystal:0.29.0 as system
---> 94db55f89e70
Step 2/19 : 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 && curl --silent --location https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs && npm install -g yarn && 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/*
---> Using cache
---> 3fe6c6fc2725
Step 3/19 : FROM system as shard-dependencies
---> 3fe6c6fc2725
Step 4/19 : WORKDIR /app
---> Using cache
---> 732ce0c2458f
Step 5/19 : COPY shard* /app/
---> Using cache
---> c2b780f3c760
Step 6/19 : RUN shards install
---> Using cache
---> a0e8ec69ed8d
Step 7/19 : FROM shard-dependencies as assets-pipeline
---> a0e8ec69ed8d
Step 8/19 : WORKDIR /app
---> Using cache
---> 7d504d35b156
Step 9/19 : COPY package.json .
---> Using cache
---> bbf4487f5383
Step 10/19 : COPY webpack* .
---> Using cache
---> dd11d53c4970
Step 11/19 : COPY src/js/ ./src/js/
---> Using cache
---> fcf53bdb4716
Step 12/19 : COPY src/css/ ./src/css/
---> Using cache
---> ff024333f146
Step 13/19 : RUN yarn install
---> Using cache
---> 791733e84ea6
Step 14/19 : RUN yarn prod
---> Using cache
---> a987739c4b26
Step 15/19 : RUN rm -rf /app/node_modules
---> Using cache
---> 954a44fc2402
Step 16/19 : FROM assets-pipeline as build
---> 954a44fc2402
Step 17/19 : WORKDIR /app
---> Using cache
---> ad4234b22ef2
Step 18/19 : COPY . /app
---> 0deddecba6aa
Step 19/19 : RUN shards build --production
---> Running in 6be076f75797
Dependencies are satisfied
Building: maestro
Removing intermediate container 6be076f75797
---> 67df086927cb
Successfully built 67df086927cb
Successfully tagged maestro_migrator:latest
Building app
Step 1/19 : FROM crystallang/crystal:0.29.0 as system
---> 94db55f89e70
Step 2/19 : 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 && curl --silent --location https://deb.nodesource.com/setup_11.x | bash - && apt-get install -y nodejs && npm install -g yarn && 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/*
---> Using cache
---> 3fe6c6fc2725
Step 3/19 : FROM system as shard-dependencies
---> 3fe6c6fc2725
Step 4/19 : WORKDIR /app
---> Using cache
---> 732ce0c2458f
Step 5/19 : COPY shard* /app/
---> Using cache
---> c2b780f3c760
Step 6/19 : RUN shards install
---> Using cache
---> a0e8ec69ed8d
Step 7/19 : FROM shard-dependencies as assets-pipeline
---> a0e8ec69ed8d
Step 8/19 : WORKDIR /app
---> Using cache
---> 7d504d35b156
Step 9/19 : COPY package.json .
---> Using cache
---> bbf4487f5383
Step 10/19 : COPY webpack* .
---> Using cache
---> dd11d53c4970
Step 11/19 : COPY src/js/ ./src/js/
---> Using cache
---> fcf53bdb4716
Step 12/19 : COPY src/css/ ./src/css/
---> Using cache
---> ff024333f146
Step 13/19 : RUN yarn install
---> Using cache
---> 791733e84ea6
Step 14/19 : RUN yarn prod
---> Using cache
---> a987739c4b26
Step 15/19 : RUN rm -rf /app/node_modules
---> Using cache
---> 954a44fc2402
Step 16/19 : FROM assets-pipeline as build
---> 954a44fc2402
Step 17/19 : WORKDIR /app
---> Using cache
---> ad4234b22ef2
Step 18/19 : COPY . /app
---> Using cache
---> 0deddecba6aa
Step 19/19 : RUN shards build --production
---> Using cache
---> 67df086927cb
Successfully built 67df086927cb
Successfully tagged maestro_app:latest
Starting maestro_db ... done
Recreating maestro_migrator ... done
Recreating maestro_app ... done
Attaching to maestro_db, maestro_migrator, maestro_app
db_1 | 2019-07-06 20:55:10.888 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2019-07-06 20:55:10.888 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2019-07-06 20:55:10.889 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2019-07-06 20:55:10.899 UTC [25] LOG: database system was shut down at 2019-07-06 20:54:10 UTC
db_1 | 2019-07-06 20:55:10.907 UTC [1] LOG: database system is ready to accept connections
migrator_1 | Unhandled exception: Unexpected error while running migrations: no driver was registered for the schema "", did you maybe forget to require the database driver? (Exception)
migrator_1 | from lib/avram/src/avram/tasks/db/migrate.cr:7:11 in 'call'
migrator_1 | from lib/avram/src/avram/tasks/db/migrate.cr:3:1 in 'print_help_or_call'
migrator_1 | from lib/lucky_cli/src/lucky_cli/runner.cr:27:9 in 'run'
migrator_1 | from tasks.cr:13:1 in '__crystal_main'
migrator_1 | from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'
migrator_1 | from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'
migrator_1 | from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
migrator_1 | from __libc_start_main
migrator_1 | from _start
migrator_1 | from ???
migrator_1 | ************************************************************
migrator_1 | "postgres://lucky:developer@db:5432/maestro_production"
migrator_1 | ************************************************************
maestro_migrator exited with code 0
database_name = "maestro_#{Lucky::Env.name}"
Avram::Repo.configure do |settings|
settings.url = ENV.fetch("DATABASE_URL")
puts "*" * 60, settings.url, "*" * 60
# settings.url = ENV["DATABASE_URL"]? || Avram::PostgresURL.build(
# database: database_name,
# hostname: ENV["DB_HOST"]? || "localhost",
# # Some common usernames are "postgres", "root", or your system username (run 'whoami')
# username: ENV["DB_USERNAME"]? || "postgres",
# # Some Postgres installations require no password. Use "" if that is the case.
# password: ENV["DB_PASSWORD"]? || "postgres"
# )
# In development and test, raise an error if you forget to preload associations
settings.lazy_load_enabled = Lucky::Env.production?
end
version: '3'
services:
db:
container_name: maestro_db
image: postgres:11.3
environment:
- POSTGRES_DB=maestro
- POSTGRES_USER=lucky
- POSTGRES_PASSWORD=developer
ports:
- "5432:5432"
volumes:
- data:/var/lib/postgresql/data
migrator:
build: .
container_name: maestro_migrator
command: lucky db.migrate
environment:
- LUCKY_ENV=development
- SECRET_KEY_BASE="p9o8Sy1+t3JPuAck9Zc/U9N7fK+KzIjxZWhGlwxdGl4="
- DATABASE_URL="postgres://lucky:developer@db:5432/maestro_production"
- APP_DOMAIN=198.199.94.41
- PORT=5000
# volumes:
# - .:/app
depends_on:
- db
links:
- db
app:
build: .
container_name: maestro_app
command: /app/bin/maestro
environment:
- LUCKY_ENV=production
- SECRET_KEY_BASE="p9o8Sy1+t3JPuAck9Zc/U9N7fK+KzIjxZWhGlwxdGl4="
- DATABASE_URL="postgres://lucky:developer@db:5432/maestro_production"
- APP_DOMAIN=198.199.94.41
- PORT=5000
ports:
- "5000:5000"
links:
- db
# volumes:
# - .:/app
# - nodes:/app/node_modules
# - shards:/app/lib
depends_on:
- db
volumes:
data:
nodes:
shards:
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