mirror of
https://github.com/JuLi0n21/homepage.git
synced 2026-04-19 15:20:05 +00:00
extract buiild step to github runner
This commit is contained in:
21
.github/workflows/docker-build.yml
vendored
21
.github/workflows/docker-build.yml
vendored
@@ -5,19 +5,26 @@ on:
|
|||||||
branches: [ "master" ]
|
branches: [ "master" ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install and Build
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
|
||||||
driver-opts: network=host
|
|
||||||
buildkitd-flags: '--allow-insecure-entitlement network.host'
|
|
||||||
|
|
||||||
- name: Login to Private Registry
|
- name: Login to Private Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -30,8 +37,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
network: host
|
|
||||||
allow: network.host
|
|
||||||
tags: |
|
tags: |
|
||||||
docker.illegalesachen.download/repository/astro-homepage:latest
|
docker.illegalesachen.download/repository/astro-homepage:latest
|
||||||
docker.illegalesachen.download/repository/astro-homepage:${{ github.sha }}
|
docker.illegalesachen.download/repository/astro-homepage:${{ github.sha }}
|
||||||
|
|||||||
12
Dockerfile
12
Dockerfile
@@ -1,18 +1,10 @@
|
|||||||
FROM node:lts-alpine AS builder
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY package*.json ./
|
|
||||||
RUN npm ci
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
FROM nginx:stable-alpine
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
RUN rm -rf /usr/share/nginx/html/*
|
RUN rm -rf /usr/share/nginx/html/*
|
||||||
|
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY ./dist /usr/share/nginx/html
|
||||||
|
|
||||||
|
# If you have a custom nginx config for Astro (SPAs/Routing), uncomment this:
|
||||||
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
# COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
Reference in New Issue
Block a user