Giter VIP home page Giter VIP logo

asdf-pre's Introduction

asdf-pre

Speed up asdf installs using precompiled installs. Made specifically to be used inside docker with alpine images.

Quick start

  1. Create a .tool-versions file
# .tool-versions
erlang 20.1
elixir 1.5.2-otp-20
nodejs 9.2.0
  1. In your Dockerfile start with alpine-asdf-pre image`
# start with fat build image
FROM teamon/alpine-asdf-pre:3.6 as build

# prepare build dir
RUN mkdir /app
WORKDIR /app

# install & cache tool dependencies
ADD .tool-versions ./
RUN asdf-pre install

# install & cache app dependencies
ENV MIX_ENV=prod
COPY mix.exs mix.lock ./
RUN mix do deps.get, deps.compile

ADD package.json package-lock.json ./
RUN npm install

# build release
COPY . .
RUN npm run build
RUN mix phx.digest
RUN mix release --verbose

# remove unnecessary files
RUN rm -rf _build/prod/rel/myapp/releases/*/*.tar.gz



# prepare tiny release image
FROM alpine:3.6
RUN apk add --update bash ca-certificates openssl

RUN mkdir /app && chown -R nobody: /app
WORKDIR /app
USER nobody

COPY --from=build /app/_build/prod/rel/myapp ./

ENV REPLACE_OS_VARS=true
EXPOSE 4000

ENTRYPOINT ["/app/bin/myapp"]

Development

Install dependencies

brew install awscli

Build tool

TOOL=elixir VERSION=1.5.2-otp-20 make tool

Debug build

make debug
# /root/build.sh TOOL VERSION
bash-4.3# /root/build.sh erlang 18.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.