-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
65 lines (52 loc) · 1.57 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
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM crystallang/crystal:0.35.1-alpine-build as build-env
ENV BUILD_PACKAGES npm git upx nginx python xvfb sqlite-static
ENV AMBER_ENV production
WORKDIR /app
RUN apk --update --no-cache add $BUILD_PACKAGES
COPY shard.yml shard.lock ./
RUN set -ex && \
shards install && \
:
COPY package.json package-lock.json ./
RUN set -ex && \
npm install && \
:
COPY . /app
RUN set -ex && \
nginx -t -c /app/config/nginx.conf && \
crystal bin/ameba.cr && \
npm run release && \
shards build --static && \
rm -f bin/xpaste && \
shards build --release --static && \
strip bin/xpaste && \
upx -9 bin/xpaste && \
rm -f bin/xpaste.dwarf && \
:
FROM alpine:latest
ENV UPDATE_PACKAGES dcron nginx enca
WORKDIR /app
ENV AMBER_ENV production
ENV CRYSTAL_ENV production
# Fix for errbit
ENV RAILS_ENV production
ENV WEB_PORT 80
COPY --from=build-env /app/bin /app/bin
COPY --from=build-env /app/public /app/public
COPY --from=build-env /app/db /app/db
COPY --from=build-env /app/src/locales /app/src/locales
COPY --from=build-env /app/config/crontab /app/config/crontab
COPY --from=build-env /app/config/environments /app/config/environments
COPY --from=build-env /app/config/nginx.conf /etc/nginx/nginx.conf
RUN set -ex && \
apk --update --no-cache -u add $UPDATE_PACKAGES && \
ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log && \
rm -rf /var/cache/apk/* && \
:
RUN set -ex && \
chown -R nginx:nginx /app/public && \
nginx -t && \
:
EXPOSE $WEB_PORT
CMD ["./bin/docker-entrypoint.sh"]