Commit b1af545 1 parent 7864119 commit b1af545 Copy full SHA for b1af545
File tree 5 files changed +125
-1
lines changed
5 files changed +125
-1
lines changed Original file line number Diff line number Diff line change
1
+ .dockerignore
2
+ # there are valid reasons to keep the .git, namely so that you can get the
3
+ # current commit hash
4
+ # .git
5
+ .log
6
+ tmp
7
+
8
+ # Mix artifacts
9
+ _build
10
+ deps
11
+ * .ez
12
+ releases
13
+
14
+ # Generate on crash by the VM
15
+ erl_crash.dump
16
+
17
+ # Static artifacts
18
+ node_modules
Original file line number Diff line number Diff line change
1
+ brasilemdados.com {
2
+ reverse_proxy 127.0.0.1:4000
3
+ tls rogervezaro1997@gmail.com
4
+ }
Original file line number Diff line number Diff line change
1
+
2
+ # Step 1 - hex dependencies
3
+ #
4
+ FROM hexpm/elixir:1.13.2-erlang-24.2.1-alpine-3.15.0 AS otp-dependencies
5
+
6
+ WORKDIR /app
7
+
8
+ ENV MIX_ENV="prod"
9
+
10
+ # Install Alpine dependencies
11
+ RUN apk add --no-cache git && \
12
+ apk --no-cache add build-base
13
+
14
+ # Install Erlang dependencies
15
+ RUN mix local.rebar --force && \
16
+ mix local.hex --force
17
+
18
+ # Install hex dependencies
19
+ # COPY mix.* ./
20
+ COPY mix.exs mix.lock ./
21
+ RUN mix deps.get --only prod
22
+ RUN mix deps.compile
23
+
24
+ # Compile codebase
25
+ COPY config config
26
+ COPY lib lib
27
+
28
+
29
+ # Compile assets
30
+ COPY priv priv
31
+ COPY assets assets
32
+
33
+ RUN mix assets.deploy
34
+
35
+ RUN mix compile
36
+ # Build OTP release
37
+ COPY rel rel
38
+ RUN mix release
39
+
40
+ #
41
+ # Step 2 - build a lean runtime container
42
+ #
43
+ FROM alpine:3.15.0
44
+
45
+ # Install Alpine dependencies
46
+ RUN apk update --no-cache && \
47
+ apk upgrade --no-cache && \
48
+ apk add --no-cache bash openssl libgcc libstdc++ ncurses-libs
49
+
50
+ WORKDIR /app
51
+
52
+ RUN chown nobody /app
53
+
54
+ # Only copy the final release from the build stage
55
+ COPY --from=otp-dependencies --chown=nobody:root /app/_build/prod/rel/brasil_em_dados ./
56
+
57
+ USER nobody
58
+
59
+ CMD /app/bin/server
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ if config_env() == :prod do
60
60
# If you are doing OTP releases, you need to instruct Phoenix
61
61
# to start each relevant endpoint:
62
62
#
63
- config :brasil_em_dados , BrasilEmDadosWeb.Endpoint , server: true
63
+ # config :brasil_em_dados, BrasilEmDadosWeb.Endpoint, server: true
64
64
#
65
65
# Then you can assemble a release by calling `mix release`.
66
66
# See `mix help release` for more information.
Original file line number Diff line number Diff line change
1
+ version : ' 3.8'
2
+ services :
3
+ web :
4
+ build :
5
+ context : .
6
+ env_file : .env
7
+ ports :
8
+ - " 4000:4000"
9
+ environment :
10
+ DATABASE_URL : " ${DATABASE_URL}"
11
+ SECRET_KEY_BASE : " ${SECRET_KEY_BASE}"
12
+ PORT : " ${PORT}"
13
+ depends_on :
14
+ - db
15
+
16
+ db :
17
+ container_name : brasil-em-dados-postgres
18
+ image : postgres:14.1-alpine
19
+ env_file : .env
20
+ restart : unless-stopped
21
+ environment :
22
+ POSTGRES_DB : " ${POSTGRES_DB}"
23
+ POSTGRES_USER : " ${POSTGRES_USER}"
24
+ POSTGRES_PASSWORD : " ${POSTGRES_PASSWORD}"
25
+ ports :
26
+ - ' 5432:5432'
27
+ volumes :
28
+ - db:/var/lib/postgresql/data
29
+
30
+ caddy :
31
+ image : caddy:2.5.0-alpine
32
+ restart : unless-stopped
33
+ ports :
34
+ - " 80:80"
35
+ - " 443:443"
36
+ volumes :
37
+ - $PWD/Caddyfile:/etc/caddy/Caddyfile
38
+ - caddy_data:/data
39
+ - caddy_config:/config
40
+ volumes :
41
+ db :
42
+ caddy_data :
43
+ caddy_config:
You can’t perform that action at this time.
0 commit comments