File tree Expand file tree Collapse file tree 4 files changed +3962
-2337
lines changed
Expand file tree Collapse file tree 4 files changed +3962
-2337
lines changed Original file line number Diff line number Diff line change 1+ Dockerfile
Original file line number Diff line number Diff line change 1+ name : Create and publish a Docker image to GitHub Packages
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ tags :
8+ - v*
9+
10+ env :
11+ IMAGE_NAME : ${{ github.repository }}
12+
13+ jobs :
14+ build-and-publish-image :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout
22+ uses : actions/checkout@v4
23+
24+ - name : Set up QEMU
25+ uses : docker/setup-qemu-action@v3
26+
27+ - name : Set up Docker Buildx
28+ uses : docker/setup-buildx-action@v3
29+
30+ - name : Log in to the Container registry
31+ uses : docker/login-action@v2
32+ with :
33+ registry : ghcr.io
34+ username : ${{ github.actor }}
35+ password : ${{ secrets.GITHUB_TOKEN }}
36+
37+ - name : Extract metadata (tags, labels) for Docker
38+ id : meta
39+ uses : docker/metadata-action@v4
40+ with :
41+ images : ghcr.io/${{ env.IMAGE_NAME }}
42+
43+ - name : Build and push Docker image
44+ uses : docker/build-push-action@v5
45+ with :
46+ context : .
47+ push : true
48+ platforms : linux/amd64,linux/arm64
49+ tags : ${{ steps.meta.outputs.tags }}
50+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 1+ # Build the image. When complete, the bundled assets are available at `/project/build/`
2+ FROM node:latest AS build
3+ WORKDIR /project/
4+ COPY . .
5+ RUN npm install \
6+ && npm run build
7+
8+ # Inject built assets into an nginx image for serving
9+ FROM nginx:latest AS app
10+ COPY --from=build /project/build /etc/nginx/html/
You can’t perform that action at this time.
0 commit comments