Fakultas Ilmu Komputer UI

Commit e77b48bb authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

Create DockerFile for building diskuy image backend

parent 69f05288
# File: docker_phx/Dockerfile
FROM elixir:1.9-alpine as build
# install build dependencies
RUN apk add --update git build-base nodejs npm yarn python
RUN mkdir /app
# install Hex + Rebar
RUN mix do local.hex --force, local.rebar --force
# set build ENV
# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix deps.get --only $MIX_ENV
RUN mix deps.compile
# build assets
# COPY assets assets
# RUN cd assets && npm install && npm run deploy
# RUN mix phx.digest
# build project
COPY priv priv
COPY lib lib
RUN mix compile
# build release
# at this point we should copy the rel directory but
# we are not using it so we can omit it
# COPY rel rel
RUN mix release
# prepare release image
FROM alpine:3.9 AS app
# install runtime dependencies
RUN apk add --update bash openssl postgresql-client
# prepare app directory
RUN mkdir /app
# copy release to app container
COPY --from=build /app/_build/prod/rel/docker_phx .
COPY entrypoint.sh .
RUN chown -R nobody: /app
USER nobody
CMD ["bash", "/app/entrypoint.sh"]
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment