Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Build prod docker image with github actions

Russ Garrettae87b307e31f
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+node_modules
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
new file mode 100644
index 0000000..a61d90f
--- /dev/null
+++ b/.github/workflows/main.yml
@@ -0,0 +1,24 @@
+name: Build
+
+on:
+ push:
+ branches: master
+
+jobs:
+ login:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+ - name: Build and push
+ id: docker_build
+ uses: docker/build-push-action@v2
+ with:
+ file: Dockerfile.prod
+ push: true
+ tags: openinframap/web:latest
diff --git a/Dockerfile.prod b/Dockerfile.prod
new file mode 100644
index 0000000..7cb19ea
--- /dev/null
+++ b/Dockerfile.prod
@@ -0,0 +1,9 @@
+FROM node:14 AS build
+WORKDIR /app
+COPY . .
+RUN npm install -g npm@latest
+RUN npm install
+RUN npm run build
+
+FROM nginx:mainline-alpine
+COPY --from=build /app/dist /usr/share/nginx/html