Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: External TeX Live docker container #13

Open
wants to merge 14 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.env
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ MYSQL_ROOT_PASSWORD=db-root-password
MYSQL_DATABASE=doubtfire-dev
MYSQL_USER=dfire
MYSQL_PASSWORD=pwd

# Latex Details
LATEX_CONTAINER_NAME=formatif-texlive-container
LATEX_BUILD_PATH=/texlive/shell/latex_build.sh
80 changes: 40 additions & 40 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
//devcontainer.json
{
"name": "Formatif Development Container",
"image": "lmsdoubtfire/formatif-devcontainer:8.3-dev",
"runArgs": ["--env-file", ".devcontainer/devcontainer.env"],
// "image": "lmsdoubtfire/formatif-devcontainer:8.3-dev",
// "runArgs": ["--env-file", ".devcontainer/devcontainer.env"],

// "dockerFile": "../dev.Dockerfile",
// "dockerComposeFile": "../development/docker-compose.yml",
// "service": "formatif-dev-container",
// "shutdownAction": "stopCompose",
"dockerComposeFile": "./docker-compose.yml",
"service": "formatif-dev-container",
"shutdownAction": "stopCompose",
// "workspaceFolder": "/workspace",

"workspaceFolder": "/workspace",
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",

"customizations": {
"vscode": {
"settings": {
Expand Down Expand Up @@ -39,41 +42,38 @@
}
},

"mounts": [
{
"source": "formatif-dev-database",
"target": "/var/lib/mysql",
"type": "volume"
},
{
"source": "formatif-dev-tmp",
"target": "/workspace/tmp",
"type": "volume"
},
{
"source": "formatif-dev-student-work",
"target": "/student-work",
"type": "volume"
},
{
"source": "ws_node_modules",
"target": "/workspace/node_modules",
"type": "volume"
},
{
"source": "web_node_modules",
"target": "/workspace/doubtfire-web/node_modules",
"type": "volume"
},
{
"source": "api_bundle",
"target": "/home/vscode/.gems",
"type": "volume"
}
],

"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
"workspaceFolder": "/workspace",
// "mounts": [
// {
// "source": "formatif-dev-database",
// "target": "/var/lib/mysql",
// "type": "volume"
// },
// {
// "source": "formatif-dev-tmp",
// "target": "/workspace/tmp",
// "type": "volume"
// },
// {
// "source": "formatif-dev-student-work",
// "target": "/student-work",
// "type": "volume"
// },
// {
// "source": "ws_node_modules",
// "target": "/workspace/node_modules",
// "type": "volume"
// },
// {
// "source": "web_node_modules",
// "target": "/workspace/doubtfire-web/node_modules",
// "type": "volume"
// },
// {
// "source": "api_bundle",
// "target": "/home/vscode/.gems",
// "type": "volume"
// }
// ],

"forwardPorts": [3000, 4200, 9876],

Expand Down
21 changes: 19 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: '3'
services:
formatif-dev-container:
container_name: formatif-dev-container
image: formatif-devcontainer:8.3-dev
container_name: 1-formatif-dev-container
build:
context: ../
dockerfile: dev.Dockerfile
Expand All @@ -16,6 +15,7 @@ services:
- web_node_modules:/workspace/doubtfire-web/node_modules
- formatif_db_compose:/var/lib/mysql
- formatif_gems_compose:/home/vscode/.gems
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "9876:9876"
- "4200:4200"
Expand All @@ -24,6 +24,23 @@ services:
command: /bin/sh -c "while sleep 5000; do :; done"
env_file:
- devcontainer.env
environment:
LATEX_CONTAINER_NAME: 1-formatif-texlive-container
LATEX_BUILD_PATH: /texlive/shell/latex_build.sh

texlive:
container_name: 1-formatif-texlive-container
build:
context: ../
dockerfile: texlive.Dockerfile
volumes:
- formatif_student-work_compose:/student-work
- ../doubtfire-api/tmp/rails-latex:/workdir/texlive-latex
- ../doubtfire-api/public/assets/images:/workspace/doubtfire-api/public/assets/images
- ../doubtfire-api/test_files:/workspace/doubtfire-api/test_files
depends_on:
- formatif-dev-container
command: /bin/sh -c "while sleep 5000; do :; done"

volumes:
ws_node_modules:
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/post_create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ln -s /workspace/.devcontainer/.irbrc $HOME


sudo chown vscode:vscode /var/lib/mysql
sudo chown vscode:vscode /var/run/docker.sock
# sudo chmod a+rw /var/lib/mysql
sudo chmod a+rw /workspace/tmp
sudo chmod a+rw /workspace/node_modules
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{
"label": "Serve Rails API",
"type": "shell",
"command": "bundle install && rails s",
"command": "bundle install && rails s -b 0.0.0.0",
"group": "build",
"presentation": {
"group": "buildGroup",
Expand Down
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ RUN apt-get update \
&& node --version \
&& npm --version \
&& gem install bundler -v '~> 2.4.5' \
&& /workspace/doubtfire-api/.ci-setup/texlive-install.sh \
# && /workspace/doubtfire-api/.ci-setup/texlive-install.sh \
&& rm -rf /workspace/doubtfire-api/.ci-setup/texlive-install.sh \
&& rm -rf /install-tl-* \
&& mkdir /run/mysqld
Expand Down
14 changes: 14 additions & 0 deletions texlive.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM texlive/texlive:latest

RUN apt-get update \
&& apt-get install -y \
imagemagick \
inkscape \
librsvg2-bin \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY ./doubtfire-api/lib/shell/latex_build.sh /texlive/shell/latex_build.sh
RUN chmod +x /texlive/shell/latex_build.sh

CMD ["sh", "-c", "while sleep 5000; do :; done"]