Files
Pinry/Dockerfile.autobuild

72 lines
2.0 KiB
Docker
Raw Normal View History

2019-03-19 07:54:41 +08:00
# -----------------------------------------------------------------------------
# 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
2019-03-19 07:54:41 +08:00
# Require: Docker (http://www.docker.io/)
# -----------------------------------------------------------------------------
# Build static yarn file
FROM node:10.20.1-alpine3.11 as yarn-build
WORKDIR pinry-spa
2020-05-05 17:41:02 +03:00
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
2019-03-19 07:54:41 +08:00
2019-03-19 08:45:33 +08:00
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 \
2020-05-05 10:45:21 +03:00
&& apt-get -y install nginx pwgen\
&& rm -rf /var/lib/apt/lists/* \
&& apt-get autoclean
2019-03-19 07:54:41 +08:00
# Install Pipfile requirements
COPY Pipfile* ./
RUN pip install rcssmin --install-option="--without-c-extensions" \
&& pip install pipenv \
&& pipenv install --three --system --clear
2019-03-19 07:54:41 +08:00
# 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 . .
2019-03-19 08:45:33 +08:00
# 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
2019-03-19 07:54:41 +08:00
# 80 is for nginx web, /data contains static files and database /start runs it.
2019-03-19 08:45:33 +08:00
EXPOSE 80
VOLUME ["/data"]
CMD ["/pinry/docker/scripts/start.sh"]