-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.development
More file actions
63 lines (44 loc) · 1.26 KB
/
Dockerfile.development
File metadata and controls
63 lines (44 loc) · 1.26 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
61
62
63
# This is for development or CI only
FROM docker.io/ruby:3.4.8-alpine3.23 AS common
RUN apk update \
&& apk upgrade \
&& apk add \
build-base shared-mime-info mariadb-dev sqlite-dev yaml-dev tzdata \
nodejs npm \
redis git vimdiff \
&& rm -rfv /var/cache/apk/*
# Diffs in red/green instead of blue/cyan
RUN echo "colorscheme retrobox" >> /root/.vimrc
ENV THOR_MERGE=vimdiff
WORKDIR /tab
COPY Gemfile Gemfile.lock ./
RUN --mount=type=cache,target=vendor/cache bundle install && bundle cache
COPY package.json package-lock.json* ./
RUN --mount=type=cache,target=/root/.npm npm i
RUN mv node_modules /node_modules
FROM common as test
ENV RAILS_ENV=test
COPY --chmod=755 <<EOF /run-test.sh
#!/bin/sh
set -eu
#[ -e node_modules ] && rm -rf node_modules
#ln -s /node_modules node_modules
bundle exec rake db:create
bundle exec rake db:schema:load
bundle exec rake
EOF
CMD ["/run-test.sh"]
FROM common as development
ENV RAILS_ENV=development
EXPOSE 80
COPY --chmod=755 <<EOF /run-development.sh
#!/bin/sh
set -eu
[ -e node_modules ] && rm -rf node_modules
ln -s /node_modules node_modules
#bundle exec rake db:migrate
./bin/dev || true
echo "Rails exited, sleeping indefinitely so dev shells don't die."
sleep inf
EOF
CMD ["/run-development.sh"]