Skip to content

Instantly share code, notes, and snippets.

@felix-d
Last active April 8, 2019 15:51
Show Gist options
  • Select an option

  • Save felix-d/6acfe282998543f6a8e77de4acab734d to your computer and use it in GitHub Desktop.

Select an option

Save felix-d/6acfe282998543f6a8e77de4acab734d to your computer and use it in GitHub Desktop.

Revisions

  1. felix-d revised this gist Dec 29, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Dockerfile
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ RUN mkdir target
    RUN tar xzf ./_build/prod/rel/$APP_NAME/releases/*/$APP_NAME.tar.gz -C ./target

    # Final image
    from alpine:latest
    FROM alpine:latest

    RUN apk add --update openssl bash && \
    rm -rf /var/cache/apk/*
  2. felix-d revised this gist Dec 29, 2017. 1 changed file with 11 additions and 13 deletions.
    24 changes: 11 additions & 13 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -1,44 +1,42 @@
    # Assets compilation
    FROM aparedes/alpine-node-yarn as node

    WORKDIR /tmp/node_modules
    ## Node modules
    COPY ./deps /tmp/deps
    COPY ./assets/package.json .
    COPY ./assets/package-lock.json .
    COPY ./assets/package.json /tmp/deps
    COPY ./assets/package-lock.json /tmp/deps
    WORKDIR /tmp/deps
    RUN yarn

    ## Assets compilation
    COPY ./assets /tmp/assets
    RUN cp -R /tmp/deps/node_modules /tmp/assets
    WORKDIR /tmp/assets
    COPY ./assets .
    RUN cp -R /tmp/node_modules/node_modules .

    RUN ./node_modules/.bin/brunch build --production

    # Distillery release
    FROM bitwalker/alpine-elixir as distillery

    ARG APP_NAME=web

    ENV MIX_ENV prod

    WORKDIR /app

    COPY . /app
    COPY --from=node /tmp/priv/static /app/priv/static
    RUN mix phx.digest && mix release --env=prod

    WORKDIR /app
    RUN mix phx.digest && mix release --env=prod
    RUN mkdir target
    RUN tar xzf ./_build/prod/rel/$APP_NAME/releases/*/$APP_NAME.tar.gz -C ./target

    # Final image
    from alpine:latest

    WORKDIR /app

    RUN apk add --update openssl bash && \
    rm -rf /var/cache/apk/*

    COPY --from=distillery /app/target /app

    ENV PORT 4000

    CMD ["./bin/web", "foreground", "--sname", "web", "--cookie", "secret"]
    WORKDIR /app
    CMD ["./bin/web", "foreground", "--sname", "web", "--cookie", "secret"]
  3. felix-d revised this gist Dec 21, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Dockerfile
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ COPY --from=node /tmp/priv/static /app/priv/static
    RUN mix phx.digest && mix release --env=prod

    RUN mkdir target
    RUN tar xzf ./_build/prod/rel/$APP_NAME/releases/$APP_NAME/web.tar.gz -C ./target
    RUN tar xzf ./_build/prod/rel/$APP_NAME/releases/*/$APP_NAME.tar.gz -C ./target

    # Final image
    from alpine:latest
  4. felix-d revised this gist Dec 21, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Dockerfile
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,8 @@ RUN ./node_modules/.bin/brunch build --production
    # Distillery release
    FROM bitwalker/alpine-elixir as distillery

    ARG APP_NAME=web

    ENV MIX_ENV prod

    WORKDIR /app
    @@ -25,7 +27,7 @@ COPY --from=node /tmp/priv/static /app/priv/static
    RUN mix phx.digest && mix release --env=prod

    RUN mkdir target
    RUN tar xzf ./_build/prod/rel/web/releases/*/web.tar.gz -C ./target
    RUN tar xzf ./_build/prod/rel/$APP_NAME/releases/$APP_NAME/web.tar.gz -C ./target

    # Final image
    from alpine:latest
  5. felix-d created this gist Dec 21, 2017.
    42 changes: 42 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    # Assets compilation
    FROM aparedes/alpine-node-yarn as node

    WORKDIR /tmp/node_modules
    COPY ./deps /tmp/deps
    COPY ./assets/package.json .
    COPY ./assets/package-lock.json .
    RUN yarn

    WORKDIR /tmp/assets
    COPY ./assets .
    RUN cp -R /tmp/node_modules/node_modules .

    RUN ./node_modules/.bin/brunch build --production

    # Distillery release
    FROM bitwalker/alpine-elixir as distillery

    ENV MIX_ENV prod

    WORKDIR /app

    COPY . /app
    COPY --from=node /tmp/priv/static /app/priv/static
    RUN mix phx.digest && mix release --env=prod

    RUN mkdir target
    RUN tar xzf ./_build/prod/rel/web/releases/*/web.tar.gz -C ./target

    # Final image
    from alpine:latest

    WORKDIR /app

    RUN apk add --update openssl bash && \
    rm -rf /var/cache/apk/*

    COPY --from=distillery /app/target /app

    ENV PORT 4000

    CMD ["./bin/web", "foreground", "--sname", "web", "--cookie", "secret"]