forked from pinry/pinry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.autobuild
71 lines (56 loc) · 2.01 KB
/
Dockerfile.autobuild
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
66
67
68
69
70
71
# -----------------------------------------------------------------------------
# docker-pinry
#
# Builds a basic docker image that can run Pinry (http://getpinry.com) and serve
# all of it's assets, there are more optimal ways to do this but this is the
# most friendly and has everything contained in a single instance.
#
# Authors: Isaac Bythewood, Jason Kaltsikis
# Updated: May 2nd, 2020
# Require: Docker (http://www.docker.io/)
# -----------------------------------------------------------------------------
# Build static yarn file
FROM node:10.20.1-alpine3.11 as yarn-build
WORKDIR pinry-spa
COPY pinry-spa/package.json pinry-spa/yarn.lock ./
RUN yarn install
COPY pinry-spa .
RUN yarn build
# Required for other database options
FROM python:3.7-slim-stretch as base
RUN apt-get update \
&& apt-get -y install gcc default-libmysqlclient-dev
RUN pip --no-cache-dir install --user mysqlclient cx-Oracle
# Final image
FROM python:3.7-slim-stretch
WORKDIR pinry
RUN mkdir /data && chown -R www-data:www-data /data
RUN groupadd -g 2300 tmpgroup \
&& usermod -g tmpgroup www-data \
&& groupdel www-data \
&& groupadd -g 1000 www-data \
&& usermod -g www-data www-data \
&& usermod -u 1000 www-data \
&& groupdel tmpgroup
# Install nginx
RUN apt-get update \
&& apt-get -y install nginx pwgen\
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoclean
# Install Pipfile requirements
COPY Pipfile* ./
RUN pip install rcssmin --install-option="--without-c-extensions" \
&& pip install pipenv \
&& pipenv install --three --system --clear
# Copy from previous stages
COPY --from=yarn-build pinry-spa/dist /pinry/pinry-spa/dist
COPY --from=base /root/.local /root/.local
ENV PATH=/root/.local/bin:$PATH
COPY . .
# Load in all of our config files.
ADD docker/nginx/nginx.conf /etc/nginx/nginx.conf
ADD docker/nginx/sites-enabled/default /etc/nginx/sites-enabled/default
# 80 is for nginx web, /data contains static files and database /start runs it.
EXPOSE 80
VOLUME ["/data"]
CMD ["/pinry/docker/scripts/start.sh"]