Skip to content

Instantly share code, notes, and snippets.

@MarbilleJuntado
Created March 29, 2019 12:15
Show Gist options
  • Save MarbilleJuntado/e7fb15bf35d28fbcdd48481e6e9d052a to your computer and use it in GitHub Desktop.
Save MarbilleJuntado/e7fb15bf35d28fbcdd48481e6e9d052a to your computer and use it in GitHub Desktop.
Dockerfile
FROM surnet/alpine-wkhtmltopdf:3.7-0.12.5-full AS wkhtmltopdf
FROM elixir:1.6.6-alpine
ENV MIX_ENV=prod \
NODE_ENV=production \
SYSTEM_ENV=docker
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
RUN apk add --update --no-cache \
yarn git build-base nodejs-current inotify-tools \
chromium-chromedriver imagemagick libxrender pdftk \
# whkhtmltopdf deps
libstdc++ libx11 libxrender libxext libssl1.0 \
ca-certificates fontconfig freetype ttf-liberation
RUN mix do local.hex --force, local.rebar --force
RUN mkdir -p /app/apps/enterprise
# intall elixir deps
WORKDIR /app
COPY mix.exs mix.lock ./
COPY apps/enterprise/mix.exs /app/apps/enterprise/
RUN mix deps.get --only prod
# install node deps
WORKDIR /app/apps/enterprise/
COPY apps/enterprise/package.json \
apps/enterprise/yarn.lock \
./
COPY apps/enterprise/webpack.config.js \
apps/enterprise/.babelrc \
apps/enterprise/postcss.config.js \
./
COPY apps/enterprise/web/static /app/apps/enterprise/web/static/
COPY config/config.exs /app/config/
COPY apps/enterprise/config/config.exs \
apps/enterprise/config/prod.exs \
/app/apps/enterprise/config/
RUN yarn install && yarn cache clean && \
yarn run deploy && rm -rf node_modules/ && \
mix phx.digest
# copy everything
WORKDIR /app
COPY . .
RUN mix compile
CMD ["mix", "do", "ecto.migrate,", "phx.server"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment