Skip to content

Commit

Permalink
feat(github-pages): test the github pages ci
Browse files Browse the repository at this point in the history
  • Loading branch information
hutchic committed Jul 19, 2024
1 parent 7b59c18 commit 3a25757
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 17 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- feat/github-pages

jobs:
build-and-deploy:
runs-on: ubuntu-latest

permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Build and Package
run: |
make package
- name: Upload Artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./app/.output/public # The path to the generated static site

deploy:
needs: build-and-deploy
runs-on: ubuntu-latest
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
FROM node:22-bullseye@sha256:549b964736c2d5c02112fd369037e981f8b935083d6fdf1a924b831930946b6c

# Set build-time arguments
ARG NODE_ENV=development
ARG USER_ID
ARG GROUP_ID

# Set environment variables
ENV NODE_ENV=${NODE_ENV}
ENV USER_ID=${USER_ID}
ENV GROUP_ID=${GROUP_ID}

# Set working directory
WORKDIR /src
Expand All @@ -14,14 +16,15 @@ WORKDIR /src
COPY app/package.json app/package-lock.json ./
RUN npm install

# Copy project files and set permissions
COPY --chown=node:node app/ .
# Copy project files
COPY app/ .

# Change to non-root user
USER node
# Ensure the correct ownership of the directories
RUN chown -R node:node /src

# Expose port 3000
EXPOSE 3000

# Default command for development
USER node
CMD ["npm", "run", "dev"]
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ clean:
rm -rf app/dist

# Generate the static site
package: clean
docker compose up -d nuxt
package: clean build
UID=$$(id -u) GID=$$(id -g) docker compose up -d nuxt
docker compose exec nuxt npm run generate
$(MAKE) stop
12 changes: 3 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ services:
build:
context: .
args:
NODE_ENV: development
container_name: nuxt_app
USER_ID: ${UID}
GROUP_ID: ${GID}
volumes:
- ./app/:/src
- /src/node_modules
Expand All @@ -15,10 +15,4 @@ services:
NODE_ENV: development
NUXI_DISABLE_VITE_HMR: true
command: npm run dev
ngrok:
image: ngrok/ngrok
environment:
NGROK_AUTHTOKEN: ${NGROK_AUTHTOKEN}
command: http --domain=boatapp.ngrok.dev nuxt:3000
ports:
- "4040:4040"
container_name: nuxt_app

0 comments on commit 3a25757

Please sign in to comment.