File tree Expand file tree Collapse file tree 2 files changed +88
-0
lines changed
Expand file tree Collapse file tree 2 files changed +88
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ name : Deploy WebApp
3+
4+ # Ensures only one deployment runs at a time
5+ concurrency : deploy
6+
7+ on :
8+ workflow_dispatch :
9+ push :
10+ branches :
11+ - main
12+ - feature/Dockerfile
13+
14+ jobs :
15+ build :
16+ name : Build and Push Container
17+ runs-on : ubuntu-24.04
18+
19+ steps :
20+ # Checkout repo and initialize submodules using a personal access token
21+ - name : Checkout repository (with private submodules)
22+ uses : actions/checkout@v4
23+ with :
24+ submodules : recursive
25+ token : ${{ secrets.GH_PAT }}
26+
27+ - name : Set up Docker Buildx
28+ uses : docker/setup-buildx-action@v3
29+
30+ - name : Login to Docker registry
31+ uses : azure/docker-login@v1
32+ with :
33+ login-server : 66gc0z34.c1.gra9.container-registry.ovh.net
34+ username : ${{ secrets.DOCKER_USERNAME }}
35+ password : ${{ secrets.DOCKER_PASSWORD }}
36+
37+ - name : Extract Docker metadata
38+ id : meta
39+ uses : docker/metadata-action@v5
40+ with :
41+ images : 66gc0z34.c1.gra9.container-registry.ovh.net/gfts/webapp
42+ tags : |
43+ type=ref,event=branch
44+ type=sha,format=short
45+ latest
46+
47+ - name : Build and push Docker image
48+ uses : docker/build-push-action@v5
49+ with :
50+ context : .
51+ file : ./Dockerfile
52+ push : true
53+ tags : ${{ steps.meta.outputs.tags }}
54+ labels : ${{ steps.meta.outputs.labels }}
55+ build-args : |
56+ GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
57+ MAPBOX_TOKEN=${{ secrets.MAPBOX_TOKEN }}
58+ WEBAPP_URL=${{ secrets.WEBAPP_URL }}
Original file line number Diff line number Diff line change 1+ FROM node:24-alpine AS builder
2+
3+ ARG WEBAPP_URL="https://gfts.developmentseed.org"
4+ ARG MAPBOX_TOKEN=""
5+ ARG GITHUB_TOKEN=""
6+
7+ ENV NODE_ENV=production
8+ ENV PUBLIC_URL=${WEBAPP_URL}
9+ ENV DATA_API=${WEBAPP_URL}
10+ ENV MAPBOX_TOKEN=${MAPBOX_TOKEN}
11+ ENV GITHUB_TOKEN=${GITHUB_TOKEN}
12+
13+ WORKDIR /app
14+
15+ # Copy the pre-cloned source code (with submodules)
16+ COPY . .
17+
18+ # Enable Corepack (to use Yarn 3+)
19+ RUN corepack enable && \
20+ yarn install --frozen-lockfile && \
21+ yarn build && \
22+ cp ./dist/index.html ./dist/404.html
23+
24+ FROM nginx:alpine-slim
25+
26+ COPY --from=builder /app/dist /usr/share/nginx/html
27+
28+ EXPOSE 80
29+
30+ CMD ["nginx" , "-g" , "daemon off;" ]
You can’t perform that action at this time.
0 commit comments