oliverdavies.uk/tools/docker/images/Dockerfile

36 lines
859 B
Docker
Raw Normal View History

2021-07-03 22:00:45 +00:00
FROM opdavies/sculpin-serve AS app
2021-07-24 19:38:35 +00:00
FROM app AS build
ENV PATH=$PATH:/app/vendor/bin/phpunit
2021-07-03 22:00:45 +00:00
WORKDIR /app
COPY composer.* ./
2021-07-24 19:38:35 +00:00
RUN composer install --no-dev
2021-07-03 22:00:45 +00:00
COPY app app
COPY source source
2021-08-25 00:30:52 +00:00
COPY src src
2021-07-24 19:38:35 +00:00
RUN sculpin generate --env prod
2021-07-03 22:00:45 +00:00
FROM node:14 AS assets
2021-07-24 19:38:35 +00:00
WORKDIR /app
2021-07-03 22:00:45 +00:00
COPY package.json .
COPY package-lock.json .
RUN npm ci
COPY . .
RUN npm run production
2021-07-24 19:38:35 +00:00
FROM nginx:1 AS production
COPY tools/docker/images/nginx/root/ /
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
RUN touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid
USER nginx
WORKDIR /code
COPY --chown=nginx --from=build /app/output_prod ./
COPY --chown=nginx --from=assets /app/source/build build
EXPOSE 8080