2021-12-29 18:31:46 +00:00
|
|
|
FROM node:14-alpine AS assets
|
|
|
|
|
|
|
|
ARG NODE_ENV="production"
|
|
|
|
ARG SCULPIN_ENV="prod"
|
|
|
|
ENV NODE_ENV="${NODE_ENV}" \
|
|
|
|
PATH="${PATH}:/node_modules/.bin" \
|
|
|
|
SCULPIN_ENV="${SCULPIN_ENV}"
|
|
|
|
|
|
|
|
RUN apk add --no-cache bash
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
RUN mkdir -p /node_modules \
|
|
|
|
&& chown node:node -R /app /node_modules
|
|
|
|
|
|
|
|
USER node
|
|
|
|
|
|
|
|
COPY --chown=node:node *yarn* package.json ./
|
|
|
|
|
|
|
|
RUN yarn install && yarn cache clean
|
|
|
|
|
|
|
|
COPY --chown=node:node . .
|
|
|
|
|
|
|
|
RUN if [ "${NODE_ENV}" != "development" ]; then \
|
|
|
|
./run yarn:build:css && ./run yarn:build:js; \
|
|
|
|
else mkdir -p /app/build; fi
|
|
|
|
|
|
|
|
CMD ["bash"]
|
|
|
|
|
|
|
|
###
|
|
|
|
|
2021-07-03 22:00:45 +00:00
|
|
|
FROM opdavies/sculpin-serve AS app
|
2021-07-24 19:38:35 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
RUN adduser --disabled-password sculpin \
|
2022-01-04 18:28:58 +00:00
|
|
|
&& mkdir /output \
|
|
|
|
&& chown sculpin:sculpin -R /app /output
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
###
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-07-24 19:38:35 +00:00
|
|
|
FROM app AS build
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-10-05 17:10:54 +00:00
|
|
|
ENV PATH=$PATH:/app/vendor/bin/phpunit
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
COPY tools/docker/images/app/root /
|
|
|
|
|
2021-07-03 22:00:45 +00:00
|
|
|
WORKDIR /app
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
USER sculpin
|
|
|
|
|
|
|
|
COPY --chown=sculpin:sculpin composer.* ./
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-07-24 19:38:35 +00:00
|
|
|
RUN composer install --no-dev
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
COPY --chown=sculpin:sculpin app app
|
|
|
|
COPY --chown=sculpin:sculpin source source
|
|
|
|
COPY --chown=sculpin:sculpin src src
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-07-24 19:38:35 +00:00
|
|
|
RUN sculpin generate --env prod
|
2021-07-03 22:00:45 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
COPY --chown=sculpin:sculpin . .
|
|
|
|
COPY --chown=sculpin:sculpin --from=assets /app/build /build
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/docker-entrypoint.sh"]
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
CMD ["bash"]
|
2021-07-03 22:00:45 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
###
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-07-24 19:38:35 +00:00
|
|
|
FROM nginx:1 AS production
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-07-24 19:38:35 +00:00
|
|
|
COPY tools/docker/images/nginx/root/ /
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-08-16 12:00:00 +00:00
|
|
|
RUN mkdir -p /code && \
|
|
|
|
chown -R nginx:nginx /code && \
|
|
|
|
chmod -R 755 /code && \
|
|
|
|
chown -R nginx:nginx /var/cache/nginx && \
|
|
|
|
chown -R nginx:nginx /var/log/nginx && \
|
|
|
|
chown -R nginx:nginx /etc/nginx/conf.d
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-08-16 12:00:00 +00:00
|
|
|
RUN touch /var/run/nginx.pid && \
|
|
|
|
chown -R nginx:nginx /var/run/nginx.pid
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-08-16 12:00:00 +00:00
|
|
|
USER nginx
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-08-16 12:00:00 +00:00
|
|
|
WORKDIR /code
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-08-16 12:00:00 +00:00
|
|
|
COPY --chown=nginx --from=build /app/output_prod ./
|
2022-01-09 20:53:37 +00:00
|
|
|
COPY --chown=nginx --from=assets /app/build build
|
2021-11-11 07:19:22 +00:00
|
|
|
|
2021-08-16 12:00:00 +00:00
|
|
|
EXPOSE 8080
|