Commit c201a095 authored by Dario Pinto's avatar Dario Pinto Committed by zapashcanon
Browse files

add CI and minor changes

parent ac34933b
stages:
- build
- image
- deploy
# Define some conditions to run the whole pipeline
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID # Run on MRs
- if: $CI_COMMIT_TAG # Run on tags
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run on master
# Customize the build rules and the artifacts here. You probably want to adjust
# "opam.locked"
# We define a cache in order to keep the switch with the dependencies installed,
# unless the opam.locked file has changed.
build:
stage: build
image: registry.ocamlpro.com/ocamlpro/ocaml-docker-images:4.12
before_script:
- "[ -d _opam ] || opam switch create . ocaml-system --deps-only --locked"
- opam clean --switch-cleanup
script:
- opam exec -- dune build --profile release @all
- opam exec -- dune runtest
- mv _build/default/src/server.exe .
cache:
key:
files:
- ocpsite.opam
paths:
- _opam
artifacts:
paths:
- server.exe
include:
- project: 'OCamlPro/gitlab-deployments'
ref: master
file: deploy.yml
# Builds and pushes the Docker image using Kaniko
make-image:
extends: .make-image # defined in deploy.yml
variables:
DOCKERFILE: /kaniko/Dockerfile
# don't need a local 'git clone'
GIT_STRATEGY: "none"
before_script:
# Write the Dockerfile for the image we want to generate
# Here we inherit from nginx and just add the contents of our web-app
- |
echo "\
FROM alpine
ADD server.exe /usr/bin
" > $DOCKERFILE
# Deployments are pre-defined in the "dev" environment; they will be stopped
# after 3 days unless they are on the default branch (master).
# To define production deployments, ensure the domain name is correct, and set
# the corresponding DNS record as "CNAME" to "a.ocaml.pro"
deploy-prod:
extends: .deploy-prod
script:
- /usr/bin/server.exe
variables:
PUBLIC_HOST: www.ocamlpro.com
# www.ocamlpro.com
Hello team,
This project is the to-be replacement website for the current [one](https://www.ocamlpro.com/)
Its functionning is quite simple in regards to the Wordpress architecture of the previous one.
Its backend is handled by the [Dream](https://github.com/aantron/dream) Library and all of its pages are written in Markdown and HTML and converted with the [Omd](https://github.com/ocaml/omd) Library.
The only style component present is the CSS framework called [Bootstrap](https://getbootstrap.com/docs/5.0/examples/cheatsheet/) that makes it very easy to add and tweak stylistic choices.
# Usage
To run the website locally simply run the following command line.
```shell
dune build @all && dune exec -- src/server.exe
```
Next, you should see the following lines appear in your terminal:
```shell
<date> <time> Running at http://localhost:8080
<date> <time> Type Ctrl+C to stop
```
Your shell should allow to click the link, otherwise copy/paste it in your favourite internet browser.
(lang dune 2.0) (lang dune 2.0)
(name ocpsite)
(license ISC)
(generate_opam_files true)
(package
(name ocpsite)
(depends
(ocaml
(>= 4.12))
(dream
(>= 1.0.0~alpha2))
(crunch
(>= 3.2.0))
(omd
(>= 2.0.0~alpha2))))
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
license: "ISC"
depends: [
"dune" {>= "2.0"}
"ocaml" {>= "4.12"}
"dream" {>= "1.0.0~alpha2"}
"crunch" {>= "3.2.0"}
"omd" {>= "2.0.0~alpha2"}
]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
(executable (executable
(name server) (public_name server)
(modules content server template) (modules content server template)
(libraries dream omd)) (libraries dream omd))
......
...@@ -20,9 +20,26 @@ let render_unsafe ~lang ~title ~content = ...@@ -20,9 +20,26 @@ let render_unsafe ~lang ~title ~content =
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="research-and-development">R&amp;D</a> <a class="nav-link" href="research-and-development">R&amp;D</a>
</li> </li>
<li class="nav-item"> <li class="nav-item dropdown">
<a class="nav-link" href="trainings">Trainings</a> <a class="nav-link dropdown-toggle" href="trainings" id="navbarDarkDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
</li> Trainings
</a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink">
<li><a class="dropdown-item" href="course_ocaml_development">OCaml Development</a></li>
<li><a class="dropdown-item" href="course_ocaml_expert">OCaml Expert</a></li>
<li><a class="dropdown-item" href="course_ocaml_code_opti">OCaml Code Optimization</a></li>
<li><a class="dropdown-item" href="course_rust_vocational_training">Rust Vocational Training</a></li>
<li><a class="dropdown-item" href="course_mastering_opam_tools">Mastering OPAM &amp; OCaml Tools</a></li>
<li><a class="dropdown-item" href="mailto:contact@ocamlpro.com">Custom Training</a></li>
</ul>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDarkDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Softwares
</a>
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="navbarDarkDropdownMenuLink">
<li><a class="dropdown-item" href="https://github.com/ocaml/opam">OPAM</a></li>
<li><a class="dropdown-item" href="https://github.com/OCamlPro/digodoc">Digodoc</a></li>
</ul>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="team">Team</a> <a class="nav-link" href="team">Team</a>
</li> </li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment