-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from felipelincoln/dev
Release v0.7.0
- Loading branch information
Showing
16 changed files
with
125 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,71 @@ | ||
FROM elixir:1.11-alpine | ||
# ----------------- | ||
# BASE | ||
# ----------------- | ||
FROM hexpm/elixir:1.11.4-erlang-23.2.7.2-alpine-3.13.3 AS base | ||
|
||
# setup compile env | ||
WORKDIR /app | ||
ARG MIX_ENV=prod | ||
WORKDIR /branchpage | ||
|
||
# install hex and rebar | ||
RUN mix do local.hex --force, local.rebar --force | ||
|
||
# install dependencies | ||
RUN apk add npm inotify-tools | ||
RUN apk add inotify-tools | ||
|
||
|
||
# ----------------- | ||
# BUILD | ||
# ----------------- | ||
FROM base AS build | ||
|
||
RUN apk add curl bash git | ||
|
||
ARG MIX_ENV=prod | ||
ENV MIX_ENV=$MIX_ENV | ||
|
||
# install mix dependencies | ||
COPY mix.exs mix.lock ./ | ||
COPY apps/web/mix.exs apps/web/mix.exs | ||
COPY config config | ||
RUN mix do deps.get, deps.compile --skip-umbrella-children | ||
|
||
# install application | ||
COPY . ./ | ||
RUN mix compile | ||
|
||
|
||
# ----------------- | ||
# RELEASE | ||
# ----------------- | ||
FROM build AS release | ||
|
||
RUN apk add npm | ||
|
||
# install node dependencies | ||
COPY apps/web/assets/package.json apps/web/assets/package-lock.json apps/web/assets/ | ||
RUN npm ci --prefix ./apps/web/assets --no-audit | ||
|
||
# generate static files | ||
COPY apps/web apps/web | ||
RUN npm run --prefix ./apps/web/assets deploy | ||
|
||
# digests and compresses static files | ||
RUN mix phx.digest | ||
|
||
# install umbrella apps | ||
COPY . ./ | ||
RUN mix compile | ||
# generate release executable | ||
RUN mix release | ||
|
||
|
||
# ----------------- | ||
# PRODUCTION | ||
# ----------------- | ||
FROM alpine:3.13.3 | ||
|
||
WORKDIR /branchpage | ||
|
||
ARG MIX_ENV=prod | ||
ENV MIX_ENV=$MIX_ENV | ||
|
||
# install dependencies | ||
RUN apk add ncurses-libs curl | ||
|
||
COPY --from=release /branchpage/_build/$MIX_ENV/rel/web ./ | ||
|
||
# start application | ||
CMD ["mix", "phx.server"] | ||
CMD ["bin/web", "start"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
defmodule Web do | ||
@moduledoc false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
defmodule Web.Application do | ||
@moduledoc false | ||
|
||
use Application | ||
|
||
def start(_type, _args) do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
defmodule Web.ArticleLive do | ||
@moduledoc false | ||
|
||
use Phoenix.LiveView | ||
import Phoenix.HTML, only: [raw: 1] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
defmodule Web.BlogLive do | ||
@moduledoc false | ||
|
||
use Phoenix.LiveView | ||
import Phoenix.HTML, only: [raw: 1] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
defmodule Web.HomeLive do | ||
@moduledoc false | ||
|
||
use Phoenix.LiveView | ||
import Phoenix.HTML, only: [raw: 1] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
defmodule Web.NewLive do | ||
@moduledoc false | ||
|
||
use Phoenix.LiveView | ||
import Phoenix.HTML, only: [raw: 1] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
defmodule Web.SearchLive do | ||
@moduledoc false | ||
|
||
use Phoenix.LiveView | ||
import Phoenix.HTML, only: [raw: 1] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import Config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "3.8" | ||
|
||
services: | ||
web: | ||
build: | ||
context: . | ||
target: base | ||
image: branchpage:latest | ||
container_name: branchpage_web | ||
command: mix phx.server | ||
restart: unless-stopped | ||
ports: | ||
- 4000:4000 | ||
volumes: | ||
- .:/branchpage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,35 @@ | ||
defmodule BranchPage.MixProject do | ||
defmodule BranchPage.Umbrella.MixProject do | ||
use Mix.Project | ||
|
||
def project do | ||
[ | ||
apps_path: "apps", | ||
version: "0.1.0", | ||
start_permanent: Mix.env() == :prod, | ||
deps: deps() | ||
preferred_cli_env: [coveralls: :test, ci: :test], | ||
test_coverage: [tool: ExCoveralls], | ||
deps: deps(), | ||
aliases: aliases(), | ||
releases: releases() | ||
] | ||
end | ||
|
||
defp deps do | ||
[] | ||
[ | ||
{:credo, "~> 1.5", only: [:dev, :test], runtime: false}, | ||
{:excoveralls, "== 0.13.3", only: [:dev, :test]} | ||
] | ||
end | ||
|
||
defp aliases do | ||
[ | ||
ci: ["format --check-formatted", "credo --strict", "test"] | ||
] | ||
end | ||
|
||
defp releases do | ||
[ | ||
web: [applications: [web: :permanent]] | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters