forked from operately/operately
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
executable file
·60 lines (44 loc) · 2.34 KB
/
Dockerfile.dev
File metadata and controls
executable file
·60 lines (44 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM elixir:1.14.2-alpine
# This is a development image. It is not intended to be used in production.
# It is intended to be used for development and testing.
# If we run everything as root, we can't mount the source code as a volume
# because the volume will be owned by root. This is a problem because the
# source code is owned by the user on the host machine. If we run everything
# as the user, we can mount the source code as a volume and the user on the
# host machine can edit the source code and the changes will be reflected
# inside the container.
# Create a user with the same UID and GID as the user on the host machine.
# This way, the user inside the container will have the same permissions as
# the user on the host machine.
ARG USER_ID
ARG GROUP_ID
# Create a user with the same UID and GID as the user on the host machine.
# We will call this user 'dev' inside of the development container.
# The name might differ from your host machine, but the UID and GID will be the same.
RUN apk update && apk add --no-cache bash git openssh nodejs npm inotify-tools chromium chromium-chromedriver postgresql-client make gcc musl-dev build-base
RUN addgroup -g ${GROUP_ID} dev && adduser -u ${USER_ID} -G dev -s /bin/ash -D dev
# Switch to the 'dev' user.
USER dev
RUN mix local.hex --force && mix local.rebar --force
RUN mix archive.install hex phx_new 1.7.0-rc.0 --force
# Set the working directory to the source code directory.
# This is where we will mount the source code from the host machine.
# The source code will be owned by the 'dev' user inside the container.
ENV APP_HOME /home/dev/app
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
# Set a simple prompt that shows the current directory.
# This is useful when you are inside the container and you want to know
# where you are, but you don't want other things to clutter the prompt.
RUN echo "export PS1='\w $ '" >> /home/dev/.bashrc
# Wallaby tests are printing out an error message without this folder.
# The error message is harmless, but it is annoying.
# This is a workaround for the error message.
#
# The message is:
# find: ‘/home/dev/.config/chromium/Crash Reports/pending/’: No such file or directory.
RUN mkdir -p "/home/dev/.config/chromium/Crash Reports/pending"
# Set the default command to run when the container starts.
# Start the phoenix server.
# CMD ["mix", "phx.server"]
CMD ["sleep", "infinity"]