-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (40 loc) · 1.66 KB
/
Dockerfile
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
# This file is part of "craft" framework.
#
# This source code is licensed under the MIT license, please view the LICENSE
# file distributed with this source code. For the full
# information and documentation: https://github.com/craft-framework/craft
# ------------------------------------------------------------------------------
FROM crystallang/crystal:1.0.0
ARG user=app
ARG uid=1000
WORKDIR /tmp
# Install deps
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
git htop apt-utils libpq-dev sqlite3 libsqlite3-dev curl
# Install watchexec & just
RUN curl -L >watchexec.tar.xz https://github.com/watchexec/watchexec/releases/download/1.14.1/watchexec-1.14.1-i686-unknown-linux-musl.tar.xz \
&& tar -xvf watchexec.tar.xz \
&& mv watchexec-1.14.1-i686-unknown-linux-musl/watchexec /usr/local/bin/ \
&& rm watchexec.tar.xz \
&& rm -rf watchexec-1.14.1-i686-unknown-linux-musl \
&& watchexec --version \
&& curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin/ \
&& just --version
# create user and grant the perm on the source file folder
RUN useradd -c 'App user' -m $user -o -u $uid
WORKDIR /app
# copy project files
COPY --chown=${user}:${user} ./shard.yml ./
COPY --chown=${user}:${user} ./justfile ./
COPY --chown=${user}:${user} ./src ./
COPY --chown=${user}:${user} ./spec ./
RUN echo "CMD_USER: $CMD_USER" \
&& rm -rf /app/lib /app/shard.lock \
&& chown ${user}:${user} -R ./
USER ${user}
# let it at the end. This way when there is a modification of the arg `APP_ENV`
# it does not rebuild every previous commands
ARG app_env=local
ENV APP_ENV=${app_env}
# default command
CMD [ "/bin/bash" ]