Skip to content

Commit

Permalink
Add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
hsjsjsj009 committed Mar 13, 2021
1 parent be73a92 commit 520b82d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# build stage
FROM node:lts-alpine as build-env
ENV NODE_ENV=production
RUN \
apk update && \
apk add git gcc g++

ADD . /opt/app
WORKDIR /opt/app
Expand All @@ -18,8 +15,6 @@ COPY --from=build-env /opt/app/envsubt.sh /etc/nginx/templates/envsubt.sh
COPY --from=build-env /opt/app/default.conf /etc/nginx/templates/default.conf.template
WORKDIR /var/www

RUN apk add --no-cache bash

ENV PORT=80

CMD ["/bin/sh", "-c", "/etc/nginx/templates/envsubt.sh && nginx -g \"daemon off;\""]
18 changes: 18 additions & 0 deletions yarn-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# build stage
FROM node:lts-alpine as build-env
ENV NODE_ENV=production

ADD . /opt/app
WORKDIR /opt/app

RUN \
yarn install && \
yarn build

FROM node:lts-alpine
WORKDIR /opt/app
COPY --from=build-env /opt/app/build /opt/app/build

RUN npm install -g serve

CMD ["serve","-s","build"]
14 changes: 14 additions & 0 deletions yarn-no-build-stage-Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# build stage
FROM node:lts-alpine as build-env
ENV NODE_ENV=production

ADD . /opt/app
WORKDIR /opt/app

RUN \
yarn install && \
yarn build && npm install -g serve

CMD ["serve","-s","build"]


0 comments on commit 520b82d

Please sign in to comment.