Skip to content

Commit 7738f60

Browse files
committed
Container deployed
to Heroku
1 parent d84dd2f commit 7738f60

File tree

4 files changed

+43
-19
lines changed

4 files changed

+43
-19
lines changed

.dockerignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
todo_backend-*.tar
24+
25+
# Since we are building assets from assets/,
26+
# we ignore priv/static. You may want to comment
27+
# this depending on your deployment strategy.
28+
/priv/static/
29+
30+
npm-debug.log
31+
/assets/node_modules
32+
*.beam
33+
.elixir_ls/

Dockerfile

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
FROM elixir:1.9.0
22
ENV DEBIAN_FRONTEND=noninteractive
33
ENV MIX_HOME=/opt/mix
4+
# Compile elixir files for production
5+
ENV MIX_ENV prod
46

57
# Install hex
68
RUN mix local.hex --force
@@ -28,9 +30,13 @@ RUN mkdir -p $APP_HOME
2830
ADD . $APP_HOME
2931
WORKDIR $APP_HOME
3032

31-
EXPOSE 4000
33+
RUN mix deps.get
34+
35+
RUN mix compile \
36+
&& mix phx.digest
3237

3338
RUN useradd -m myuser
3439
USER myuser
3540

36-
CMD ["mix", "phx.server"]
41+
42+
CMD MIX_ENV=prod mix phx.server

Makefile

-15
This file was deleted.

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
ports:
1111
- "82:80"
1212
web:
13-
build: .
13+
image: docker.io/geegog/docker-phoenix
1414
environment:
1515
- MIX_ENV=dev
1616
- PORT=4000
@@ -24,7 +24,7 @@ services:
2424
networks:
2525
- my-network
2626
test:
27-
build: .
27+
image: docker.io/geegog/docker-phoenix
2828
command: mix test
2929
environment:
3030
- MIX_ENV=test

0 commit comments

Comments
 (0)