Skip to content
This repository has been archived by the owner on Aug 21, 2021. It is now read-only.

Commit

Permalink
perform code build inside docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonk000 committed Mar 13, 2019
1 parent 08d870c commit af4f73f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM node:8-alpine as nodebuilder

COPY . src/
WORKDIR /src
RUN npm install
RUN npm run build-prod

#########################

FROM alpine:latest

RUN mkdir -p /usr/share/nginx/html
COPY /dist /usr/share/nginx/html
COPY --from=nodebuilder /src/dist /usr/share/nginx/html
RUN apk add --update curl && \
curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://caddyserver.com/download/linux/amd64?license=personal" \
| tar --no-same-owner -C /usr/bin/ -xz caddy && \
chmod 0755 /usr/bin/caddy && \
/usr/bin/caddy -version && \
apk del curl && \
apk del curl && \
rm -rf /root/.cache /root/.config /root/.local /root/.ash_history \
/usr/share/man /var/cache/apk/*
/usr/share/man /var/cache/apk/*

EXPOSE 80
CMD ["/usr/bin/caddy", "-root", "/usr/share/nginx/html", "-port", "80"]
VOLUME ["/usr/share/nginx/html"]

0 comments on commit af4f73f

Please sign in to comment.