joshwlewis/docker-heroku-phoenix

语言:

git: https://github.com/joshwlewis/docker-heroku-phoenix

README.md (中文)

泊坞窗,Heroku的凤凰

这是一个用于Phoenix Framework应用程序的Dockerfile和Docker镜像 Heroku平台。这是一个很大程度上取代git push和的工作流程 buildpacks并提供更高级别的dev-prod奇偶校验。有关更多信息 工作流程,结帐Heroku Devcenter。

这个图像比标题更通用。它与任何人无关 凤凰图书馆或早午餐,所以它适用于任何项目 建立在您想要部署到Heroku的Elixir和Node上。

这是做什么的:

  • 从基础heroku / cedar开始:14个docker图像。
  • 从源代码构建和安装Erlang。
  • 从源代码构建和安装Elixir。
  • 从源代码构建和安装Node.js.
  • 安装Hex,Elixir的包管理器。
  • 安装NPM,Node的包管理器。

用法示例:

一个vanilla Phoenix应用程序的Dockerfile将会是这样的:

FROM joshwlewis/docker-heroku-phoenix:latest

# Compile elixir files for production
ENV MIX_ENV prod
# This prevents us from installing devDependencies
ENV NODE_ENV production
# This causes brunch to build minified and hashed assets
ENV BRUNCH_ENV production

# We add manifests first, to cache deps on successive rebuilds
COPY ["mix.exs", "mix.lock", "/app/user/"]
RUN mix deps.get

# Again, we're caching node_modules if you don't change package.json
ADD package.json /app/user/
RUN npm install

# Add the rest of your app, and compile for production
ADD . /app/user/
RUN mix compile \
    && brunch build \
    && mix phoenix.digest

你的docker-compose看起来像这样:

web:
  build: .
  command: 'bash -c ''mix phoenix.server'''
  dockerfile: Dockerfile.prod
  working_dir: /app/user
  environment:
    LANG: en_US.UTF-8
    HOST: localhost
    PORT: 4000
    DATABASE_URL: 'postgres://postgres:@postgres:4000/api_prod'
  ports:
    - '4000:4000'
  links:
    - postgres
postgres:
  image: postgres

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Docker-Heroku-Phoenix

This is a Dockerfile and Docker image for use with Phoenix Framework apps on
the Heroku Platform. This is a workflow that largely replaces git push and
buildpacks and offers a higher level of dev-prod parity. For more on the
workflow, checkout the Heroku Devcenter.

This image a bit more generic than the title lets on. It's not tied to any
Phoenix libraries or Brunch, so it's feasible for use on any project that is
built on Elixir and Node that you'd like to deploy to Heroku.

What this does:

  • Starts from the base heroku/cedar:14 docker image.
  • Builds and Installs Erlang from source.
  • Builds and Installs Elixir from source.
  • Builds and Installs Node.js from source.
  • Installs Hex, the package manager for Elixir.
  • Installs NPM, the package manager for Node.

Example Usage:

A Dockerfile for a vanilla Phoenix app going to prod would look like this:

FROM joshwlewis/docker-heroku-phoenix:latest

# Compile elixir files for production
ENV MIX_ENV prod
# This prevents us from installing devDependencies
ENV NODE_ENV production
# This causes brunch to build minified and hashed assets
ENV BRUNCH_ENV production

# We add manifests first, to cache deps on successive rebuilds
COPY ["mix.exs", "mix.lock", "/app/user/"]
RUN mix deps.get

# Again, we're caching node_modules if you don't change package.json
ADD package.json /app/user/
RUN npm install

# Add the rest of your app, and compile for production
ADD . /app/user/
RUN mix compile \
    && brunch build \
    && mix phoenix.digest

And your docker-compose would look like this:

web:
  build: .
  command: 'bash -c ''mix phoenix.server'''
  dockerfile: Dockerfile.prod
  working_dir: /app/user
  environment:
    LANG: en_US.UTF-8
    HOST: localhost
    PORT: 4000
    DATABASE_URL: 'postgres://postgres:@postgres:4000/api_prod'
  ports:
    - '4000:4000'
  links:
    - postgres
postgres:
  image: postgres