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" \
|
2022-07-22 20:39:49 +00:00
|
|
|
SCULPIN_ENV="${SCULPIN_ENV}" \
|
|
|
|
USER="node"
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache bash
|
|
|
|
|
2022-07-22 20:39:49 +00:00
|
|
|
WORKDIR /app/assets
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
RUN mkdir -p /node_modules \
|
|
|
|
&& chown node:node -R /app /node_modules
|
|
|
|
|
|
|
|
USER node
|
|
|
|
|
2022-07-22 20:39:49 +00:00
|
|
|
COPY --chown=node:node assets/*yarn* assets/package.json ./
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
RUN yarn install && yarn cache clean
|
|
|
|
|
2022-07-22 20:39:49 +00:00
|
|
|
COPY --chown=node:node . ..
|
2021-12-29 18:31:46 +00:00
|
|
|
|
|
|
|
RUN if [ "${NODE_ENV}" != "development" ]; then \
|
2022-07-22 20:39:49 +00:00
|
|
|
../run yarn:build:css && ../run yarn:build:js; \
|
2021-12-29 18:31:46 +00:00
|
|
|
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
|
|
|
|
|
2022-02-16 20:34:51 +00:00
|
|
|
RUN mkdir /output \
|
|
|
|
&& chown sculpin:sculpin -R /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
|
|
|
|
2022-01-26 08:46:36 +00:00
|
|
|
RUN sculpin generate --env prod --output-dir /output/html
|
2021-07-03 22:00:45 +00:00
|
|
|
|
2021-12-29 18:31:46 +00:00
|
|
|
COPY --chown=sculpin:sculpin . .
|
2022-07-20 07:33:50 +00:00
|
|
|
COPY --chown=sculpin:sculpin --from=assets /app/source/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"]
|
2022-01-26 08:47:03 +00:00
|
|
|
|
|
|
|
###
|
|
|
|
|
|
|
|
FROM alpine AS production
|
|
|
|
|
|
|
|
COPY --from=build /output/html /app
|
|
|
|
|
|
|
|
CMD ["sh"]
|