Skip to content

Commit

Permalink
update packages, deprecations, devcontainer and make formatter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mabiede committed Oct 26, 2023
1 parent e0b304a commit 900e9c0
Show file tree
Hide file tree
Showing 70 changed files with 618 additions and 605 deletions.
63 changes: 31 additions & 32 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,67 +1,66 @@
FROM node:16 AS node_base
FROM node:lts AS node
FROM hadolint/hadolint:latest-alpine AS hadolint
FROM ocaml/opam:debian-ocaml-4.12
FROM ocaml/opam:debian-10-ocaml-4.14

# copy node from node_base container and link commands
USER root
COPY --from=node_base /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node_base /usr/local/bin/node /usr/local/bin/node
COPY --from=node_base /opt /opt

# copy node from node container and link commands
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY --from=node /usr/local/bin/node /usr/local/bin/node
COPY --from=node /opt /opt
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
&& ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& ln -s /opt/yarn-v*/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn-v*/bin/yarnpkg /usr/local/bin/yarnpkg

# copy hadolint
COPY --from=hadolint /bin/hadolint /bin/hadolint

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND noninteractive
ENV SIHL_ENV development

RUN apt-get update -q \
&& apt-get install -yqq --no-install-recommends \
default-jre \
# emacs-nox for emacs, but sihl cannot be installed without
emacs-nox \
git \
# install packages
# hadolint ignore=DL3008
RUN apt-get update -q && apt-get install -yqq --no-install-recommends \
# development dependencies
inotify-tools \
zsh \
m4 \
wget \
#
# build dependencies (would also be installed by opam depext)
gcc \
libev-dev \
libffi-dev \
libfontconfig \
libgmp-dev \
libmariadb-dev \
libpq-dev \
libqt5gui5 \
libssl-dev \
lsof \
m4 \
pdftk-java \
perl \
pkg-config \
utop \
wget \
wkhtmltopdf \
xvfb \
zip \
zlib1g-dev \
zsh \
#
# cleanup installations
&& apt-get autoremove -y \
&& apt-get clean all \
#
# add timezone
&& ln -fs /usr/share/zoneinfo/Europe/Zurich /etc/localtime
&& rm -rf /var/lib/apt/lists/*

# add timezone
RUN ln -fs /usr/share/zoneinfo/Europe/Zurich /etc/localtime

# WTF: https://github.com/mirage/ocaml-cohttp/issues/675
RUN bash -c 'echo "http 80/tcp www # WorldWideWeb HTTP" >> /etc/services' \
&& bash -c 'echo "https 443/tcp www # WorldWideWeb HTTPS" >> /etc/services'

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog
USER opam

# install oh-my-zsh
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -q -O - | zsh \
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
&& sed -i "/^plugins=/c\plugins=(git dotenv)" ~/.zshrc
&& sed -i "/^plugins=/c\plugins=(git dotenv)" ~/.zshrc \
#
# link make to devcontainer makefile
&& echo 'alias make="make -f /workspace/.devcontainer/Makefile"' >> ~/.zshrc

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog
3 changes: 3 additions & 0 deletions .devcontainer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include ./Makefile

SHELL = bash
55 changes: 29 additions & 26 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,34 @@
"postCreateCommand": "bash .devcontainer/postCreate.sh",
// Use 'settings' to set *default* container specific settings.json values on container create.
// You can edit these settings after create using File > Preferences > Settings > Remote.
"settings": {
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnSave": true,
"files.associations": {
"*.ml": "ocaml",
"*.mli": "ocaml"
},
"ocaml.sandbox": {
"kind": "global",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
},
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.formatOnSave": true,
"files.associations": {
"*.ml": "ocaml",
"*.mli": "ocaml"
},
"ocaml.sandbox": {
"kind": "global"
}
},
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"donjayamanne.githistory",
"eamodio.gitlens",
"exiasr.hadolint",
"irongeek.vscode-env",
"ocamllabs.ocaml-platform",
"DavidAnson.vscode-markdownlint",
"ms-vscode.makefile-tools"
]
}
},
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
// general useful extensions
"donjayamanne.githistory",
"eamodio.gitlens",
"editorconfig.editorconfig",
"exiasr.hadolint",
"ms-azuretools.vscode-docker",
// project extensions
"ocamllabs.ocaml-platform"
]
}
}
14 changes: 9 additions & 5 deletions .devcontainer/postCreate.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# ocaml/opam post create script
#!/bin/sh

# immediately when a command fails and print each command
set -ex

sudo chown -R opam: _build
sudo chown -R opam: node_modules

# initialize project and update environmemnt
opam init -a --shell=zsh
eval $(opam env)

# get newest opam packages
opam remote remove --all default
opam remote add default https://opam.ocaml.org

# ensure all system dependencies are installed
opam pin add . --yes --no-action
opam depext sihl sihl-user sihl-storage sihl-email sihl-queue sihl-cache sihl-token --yes --with-doc --with-test

eval $(opam env)

# install opam packages used for vscode ocaml platform package
# e.g. when developing with emax, add also: utop merlin ocamlformat
make deps
opam install -y ocaml-lsp-server

# install yarn packages
yarn
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ deps:

.PHONY: create_switch
create_switch:
opam switch create . 4.12.0 --no-install --locked
opam switch create . 4.14.1 --no-install --locked
eval $(opam env)

.PHONY: switch
Expand Down
5 changes: 5 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
(env
(dev
(flags
(:standard -w -70 -warn-error -70))))

(data_only_dirs node_modules .devcontainer .git)
50 changes: 31 additions & 19 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(ocaml
(>= 4.12.0))
(conformist
(>= 0.6.0))
(>= 0.8.1))
(dune-build-info
(>= 2.8.4))
(tsort
Expand All @@ -54,16 +54,14 @@
(>= 0.11.1))
(ssl
(>= 0.5.9))
(uuidm
(>= 0.9.7))
(lwt_ssl
(>= 1.1.3))
(lwt_ppx
(>= 2.0.1))
(caqti
(>= 1.8.0))
(>= 2.0.1))
(caqti-lwt
(>= 1.3.0))
(>= 2.0.1))
(safepass
(>= 3.0))
(jwto
Expand All @@ -88,13 +86,15 @@
(and
(>= 1.4.0)
:with-test))
(mariadb
(>= 1.1.6))
(caqti-driver-postgresql
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))
(caqti-driver-mariadb
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))))

(package
Expand All @@ -116,13 +116,15 @@
(and
(>= 1.4.0)
:with-test))
(mariadb
(>= 1.1.6))
(caqti-driver-postgresql
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))
(caqti-driver-mariadb
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))))

(package
Expand All @@ -139,13 +141,15 @@
(and
(>= 1.4.0)
:with-test))
(mariadb
(>= 1.1.6))
(caqti-driver-postgresql
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))
(caqti-driver-mariadb
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))))

(package
Expand All @@ -163,13 +167,15 @@
(and
(>= 1.4.0)
:with-test))
(mariadb
(>= 1.1.6))
(caqti-driver-postgresql
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))
(caqti-driver-mariadb
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))))

(package
Expand All @@ -187,13 +193,15 @@
(and
(>= 1.4.0)
:with-test))
(mariadb
(>= 1.1.6))
(caqti-driver-postgresql
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))
(caqti-driver-mariadb
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))))

(package
Expand All @@ -214,13 +222,15 @@
(and
(>= 1.4.0)
:with-test))
(mariadb
(>= 1.1.6))
(caqti-driver-postgresql
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))
(caqti-driver-mariadb
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))))

(package
Expand All @@ -240,11 +250,13 @@
(and
(>= 1.4.0)
:with-test))
(mariadb
(>= 1.1.6))
(caqti-driver-postgresql
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))
(caqti-driver-mariadb
(and
(>= 1.8.0)
(>= 2.0.1)
:with-test))))
5 changes: 3 additions & 2 deletions sihl-cache.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ depends: [
"ocaml" {>= "4.08.0"}
"sihl" {= version}
"alcotest-lwt" {>= "1.4.0" & with-test}
"caqti-driver-postgresql" {>= "1.8.0" & with-test}
"caqti-driver-mariadb" {>= "1.8.0" & with-test}
"mariadb" {>= "1.1.6"}
"caqti-driver-postgresql" {>= "2.0.1" & with-test}
"caqti-driver-mariadb" {>= "2.0.1" & with-test}
"odoc" {with-doc}
]
build: [
Expand Down
10 changes: 2 additions & 8 deletions sihl-cache.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ homepage: "https://github.com/oxidizing/sihl"
doc: "https://oxidizing.github.io/sihl/"
bug-reports: "https://github.com/oxidizing/sihl/issues"
depends: [
"base-bigarray" {= "base"}
"base-threads" {= "base"}
"base-unix" {= "base"}
"dune" {= "3.0.3"}
"ocaml" {= "4.12.1"}
"ocaml-base-compiler" {= "4.12.1"}
"dune" {= "3.11.1"}
"ocaml" {= "4.14.1"}
]
build: [
["dune" "subst"] {dev}
Expand All @@ -32,7 +30,3 @@ build: [
]
dev-repo: "git+https://github.com/oxidizing/sihl.git"
name: "sihl-cache"
pin-depends: [
"ocaml-base-compiler.4.12.1"
"https://github.com/ocaml/ocaml/archive/4.12.1.tar.gz"
]
Loading

0 comments on commit 900e9c0

Please sign in to comment.