Hosting Your Own GitLab Page on the CoCo Instance
GitLab makes it quick and easy to host your own static website. Here’s how to do it:
-
Create a GitLab Repository
- Follow this guide.
-
Clone your new repository
- Follow this guide.
-
Open the cloned repository in a code editor of your choice
- For example, use:
- Visual Studio Code Install Guide
- IntelliJ IDE Install Guide
- For example, use:
-
Create a ".gitlab-ci.yml" file
- Place this file directly in the cloned folder.
- Ensure the name starts with a dot.
stages:
- deploy
pages:
stage: deploy
script:
- echo "Deploying..."
- mkdir -p public
- cp index.html public/
artifacts:
paths:
- public
only:
- main -
Create an index.html file
- This file will be displayed on your webpage.
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Some title</title>
</head>
<body>
<div>
Hello, World!
</div>
</body>
</html> -
Commit and push everything -> You're online!
-
Find the link
Possible Issues
-
The "Pages" menu item shows you the setup page instead of a URL
- Make sure the job in your gitlab-ci.yml is named "pages" and not "deploy".
pages: # this must be 'pages', not 'deploy'
stage: deploy- Open the "Build" > "Pipelines" menu item to verify the correction.
- Before:
- After:
- Before:
-
The URL shown doesn't work
- Before:
- Uncheck "Use unique domain" under the menu item: "Deploy" > "Pages".
- Before:
warning
Please note that you may need to consider legal requirements when making content available on the internet.