1
0
mirror of https://gitlab.com/Anson-Projects/projects.git synced 2025-06-15 14:36:47 +00:00

Merge branch 'cache-ci' into 'master'

Add container for speedier development and builds

See merge request Anson-Projects/projects!3
This commit is contained in:
Anson Biggs 2024-03-03 04:17:01 +00:00
commit 27e3681c34
4 changed files with 40 additions and 43 deletions

View File

@ -1,21 +0,0 @@
FROM ghcr.io/quarto-dev/quarto-full:1.5.22
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
&& apt-get -y install git iproute2 procps lsb-release \
&& apt-get -y install python3 python3-pip \
&& apt-get -y install r-base \
&& apt-get -y install julia
RUN python3 -m pip install jupyter
# https://discourse.julialang.org/t/how-to-install-all-packages-in-a-project-into-the-general-julia-manifest/84143
# RUN julia -e "using Pkg; Pkg.instantiate()"
# COPY Project.toml /root/.julia/environments/v1.4/Project.toml
# COPY Manifest.toml /root/.julia/environments/v1.4/Manifest.toml
# RUN julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"
# # RUN quarto serve

View File

@ -1,15 +1,14 @@
{
"name": "Anson's Projects",
"build":{
"dockerfile": "Dockerfile"
},
"image": "registry.gitlab.com/anson-projects/projects:latest",
"customizations": {
"vscode": {
"extensions": [
"quarto.quarto",
"julialang.language-julia"
"julialang.language-julia",
"redhat.vscode-yaml",
"ms-azuretools.vscode-docker"
]
}
}
// "postCreateCommand": "julia -e 'import Pkg; Pkg.activate(\".\"); Pkg.instantiate()'"
}

View File

@ -1,25 +1,27 @@
image: ghcr.io/quarto-dev/quarto-full:1.5.22
stages:
- build
- deploy
build_project:
build:master:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.21.0-debug
entrypoint: [""]
script:
- apt-get update
- apt-get -y install --no-install-recommends apt-utils dialog 2>&1
- apt-get -y install git iproute2 procps lsb-release
- apt-get -y install python3 python3-pip
- apt-get -y install r-base
- apt-get -y install julia
- python3 -m pip install jupyter
- julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"
- cp Project.toml /root/.julia/environments/v1.4/Project.toml
- cp Manifest.toml /root/.julia/environments/v1.4/Manifest.toml
- julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"
- echo "Building the project with Quarto..."
- quarto render --to html --output-dir public
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}"
--destination "${CI_REGISTRY_IMAGE}:latest"
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
render-quarto:
stage: deploy
image: ${CI_REGISTRY_IMAGE}:latest
script:
- echo "Building the project with Quarto..."
- quarto render --to html --output-dir public
artifacts:
paths:
- public
@ -29,7 +31,7 @@ pages:
script:
- echo "Publishing site..."
dependencies:
- build_project
- render-quarto
artifacts:
paths:
- public

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM ghcr.io/quarto-dev/quarto-full:1.5.22
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils dialog \
git iproute2 procps lsb-release \
python3 python3-pip \
r-base \
julia \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install jupyter
# Assuming Project.toml and Manifest.toml are copied to the correct locations
COPY Project.toml /root/.julia/environments/v1.4/
COPY Manifest.toml /root/.julia/environments/v1.4/
RUN julia -e "using Pkg; Pkg.instantiate(); Pkg.precompile()"