|
|
@@ -0,0 +1,45 @@ |
|
|
|
# Use the NodeJS image as builder |
|
|
|
FROM node:lts AS builder |
|
|
|
|
|
|
|
# Create the workspace |
|
|
|
RUN mkdir -p /usr/src/app/example |
|
|
|
WORKDIR /usr/src/app |
|
|
|
|
|
|
|
# Copy over the package, and install the dependencies |
|
|
|
COPY package.json /usr/src/app |
|
|
|
COPY example/package.json /usr/src/app/example |
|
|
|
RUN yarn |
|
|
|
WORKDIR /usr/src/app/example |
|
|
|
RUN yarn |
|
|
|
WORKDIR /usr/src/app |
|
|
|
|
|
|
|
# Copy over the other files. |
|
|
|
COPY src /usr/src/app/src |
|
|
|
COPY theme /usr/src/app/theme |
|
|
|
COPY rollup.config.js /usr/src/app |
|
|
|
COPY tsconfig.json /usr/src/app |
|
|
|
|
|
|
|
# Build the application |
|
|
|
RUN yarn build |
|
|
|
|
|
|
|
# Switch to the example folder |
|
|
|
WORKDIR /usr/src/app/example |
|
|
|
|
|
|
|
# Copy over the other files. |
|
|
|
COPY example/.sassrc /usr/src/app/example |
|
|
|
COPY example/tsconfig.json /usr/src/app/example |
|
|
|
COPY example/src /usr/src/app/example/src |
|
|
|
|
|
|
|
# Build the example |
|
|
|
RUN yarn build |
|
|
|
|
|
|
|
# The actual server, this builds the final image |
|
|
|
FROM nginx:alpine |
|
|
|
|
|
|
|
# Copy the nginx configuration |
|
|
|
COPY nginx.conf /etc/nginx/nginx.conf |
|
|
|
|
|
|
|
# Copy the output of the builder |
|
|
|
COPY --from=builder /usr/src/app/example/dist /usr/share/nginx/html |
|
|
|
RUN chown nginx:nginx /usr/share/nginx/html/ -R |
|
|
|
EXPOSE 80 |