Commit eeae7306 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

+ add Dockerfile and docs in README how to build

parent d642d8e2
.git
node_modules
dist
.DS_Store
node_modules
/dist
/dist_docker
# all dev/prod specific env files; we have sample.env.* as templates
.env.*
......
FROM node:lts-alpine AS base
WORKDIR /aura
COPY package*.json ./
RUN npm install
FROM base AS dev
EXPOSE 8000
CMD ["npm", "run", "serve"]
FROM base AS prod
COPY . .
CMD ["npm", "run", "build"]
......@@ -74,6 +74,44 @@ recommended).
> TODO: provide an example setup
### Building/running with Docker
You can use Docker either to run the local development server, if you do not
want to set up node/npm on your host, or you can use Docker to just build the
_dist_ directory, that you then use in your dashboard's web root.
Before you build any image and run containers, make sure you followed the
steps above in the _Configuration_ section.
To create the image for the dev container and run it use the following:
```bash
docker build -t dashboard-dev --target=dev .
docker run --rm -it -v $(pwd):/aura -p 8080:8080 dashboard-dev
```
To use the build image to build the _dist_ directory do the following:
```bash
docker build -t dashboard --target=prod .
docker run --rm -it -v "$(pwd)"/dist_docker:/aura/dist_docker dashboard \
sh -c 'npm run build && mv dist/* dist_docker'
```
In this case the final result will be put into the `dist_docker` directory, so
you can have different builds through docker and a local dev setup.
If you do not use any local dev setup and want to get the built files directly
into the `dist` directory, just change the `"$(pwd)"/dist_docker` in the volume
option to `"$(pwd)"/dist`. (If you are wondering why inside the container we
copy everything from the `dist` to the `dist_docker` container: this is a
workaround, because the build process needs the `dist` directory unlocked,
which is not the case if we bind it to a volume)
A more comprehensive setup in combination with other AuRa components can be
found in the [meta repository](https://gitlab.servus.at/aura/meta).
## Common problems and solutions
### Access to steering is denied due to CORS issues
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment