deployment: merge into root dockerfile

This commit is contained in:
Patrik Oldsberg
2020-03-31 00:17:15 +02:00
parent cc3120c35f
commit 9a5ed723c4
4 changed files with 9 additions and 35 deletions
+8 -1
View File
@@ -15,4 +15,11 @@ RUN yarn build
FROM nginx:mainline
COPY --from=builder /app/packages/app/build /usr/share/nginx/html
COPY ./docker/default.conf /etc/nginx/conf.d/default.conf
# Run nginx as root
RUN sed -i 's/user nginx.*$//' /etc/nginx/nginx.conf
COPY docker/default.conf.template /etc/nginx/conf.d/default.conf.template
CMD /bin/bash -c "envsubst '\$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf" && nginx -g 'daemon off;'
ENV PORT 80
-24
View File
@@ -1,24 +0,0 @@
FROM node:12 as builder
WORKDIR /app
COPY package.json yarn.lock .yarnrc .npmrc /app/
COPY .yarn /app/.yarn
COPY packages /app/packages
COPY plugins /app/plugins
RUN yarn
COPY . .
RUN yarn build
FROM nginx:mainline
COPY --from=builder /app/packages/app/build /usr/share/nginx/html
# Run nginx as root
RUN sed -i 's/user nginx.*$//' /etc/nginx/nginx.conf
# Copy in the nginx conf template and replace "$PORT" with the environment variable set by heroku
COPY deployment/default.conf.template /etc/nginx/conf.d/default.conf.template
CMD /bin/bash -c "envsubst '\$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf" && nginx -g 'daemon off;'
-8
View File
@@ -1,8 +0,0 @@
server {
listen $PORT default_server;
location / {
root /usr/share/nginx/html;
index index.html;
}
}
@@ -1,5 +1,5 @@
server {
listen 80;
listen $PORT;
server_name localhost;
#charset koi8-r;
@@ -20,4 +20,3 @@ server {
root /usr/share/nginx/html;
}
}