-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (45 loc) · 1.52 KB
/
Dockerfile
File metadata and controls
53 lines (45 loc) · 1.52 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
# HackTheArch Dockerfile
# VERSION 3.0
################################################################################
# Builder
################################################################################
FROM ruby:3-alpine as builder
RUN apk add --no-cache --update \
build-base \
curl-dev \
sqlite-dev \
nodejs \
libpq \
postgresql \
imagemagick \
libxml2-dev \
postgresql-dev \
postgresql-client
WORKDIR /src
COPY Gemfile* ./
RUN bundle install --with production -j4 --retry 3 \
&& rm -rf /usr/local/bundle/cache/*.gem \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
ADD . ./
RUN mkdir -p ./tmp/cache ./log
################################################################################
# Production
################################################################################
FROM ruby:3-alpine as prod
MAINTAINER Paul Jordan <paullj1@gmail.com>
RUN apk add --no-cache --update \
imagemagick \
nodejs \
postgresql-client \
tzdata \
&& addgroup -g 1000 -S app \
&& adduser -u 1000 -S app -G app
WORKDIR /app
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
COPY --from=builder --chown=app:app /src ./
HEALTHCHECK --interval=30s --timeout=3s \
CMD echo -e 'require "net/http"\nexit(Net::HTTP.get_response(URI("http://127.0.0.1:3000/")).code.to_i < 400)' | ruby
USER app
CMD [ "bundle", "exec", "puma", "-C", "/app/config/puma.rb" ]
EXPOSE 3000