Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM node:20-alpine AS build

# Copy files as a non-root user. The `node` user is built in the Node image.
WORKDIR /usr/src/app
RUN chown node:node ./
USER node
# Defaults to production, docker-compose overrides this to development on build and run.
ARG NODE_ENV=dev
ENV NODE_ENV=$NODE_ENV
# Install dependencies first, as they change less often than code.
COPY package.json package-lock.json* ./
RUN npm ci && npm cache clean --force
COPY ./src ./src
COPY ./scripts ./scripts
COPY ./*js ./
USER root
RUN npm install
RUN npm run update-templates
# Execute NodeJS (not NPM script) to handle SIGTERM and SIGINT signals.
USER node
RUN npm run build

FROM httpd:alpine3.21
COPY --from=build /usr/src/app/dist/index* /usr/local/apache2/htdocs/
COPY --from=build /usr/src/app/dist/assets/* /usr/local/apache2/htdocs/assets/
COPY ./images/* /usr/local/apache2/htdocs/images/
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ npm run build
# deploy dist folder
```

```bash
# To run the dockerfile
docker build . -t datacontract-editor
docker run -it -p 8080:80 datacontract-editor
```

## How to update the templates

Templates are taken from the Data Contract CLI and are fetched directly from the repository.
Expand Down