Skip to content

Commit 8ff3347

Browse files
committed
Move .wdl MIME fix to Dockerfiles for reliability (PHP-130724)
The startup script approach was unreliable because post-startup.sh could fail before reaching the MIME registration block. Move the fix to Dockerfiles so it's baked into the container image at build time, guaranteeing the MIME type is registered before RStudio Server starts. Changes: - Create Dockerfile for r-analysis with .wdl MIME type registration - Update docker-compose.yaml to use build context - Add MIME fix to r-analysis-aou Dockerfile - Remove runtime MIME registration from post-startup.sh
1 parent d3c737b commit 8ff3347

6 files changed

Lines changed: 27 additions & 23 deletions

File tree

src/r-analysis-aou/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.5
22

3+
# Register .wdl (Workflow Description Language) as a text MIME type so RStudio
4+
# opens .wdl files as text instead of misidentifying them as binary (PHP-130724).
5+
COPY wdl.xml /usr/share/mime/packages/wdl.xml
6+
RUN update-mime-database /usr/share/mime
7+
38
ARG USER=rstudio
49
ARG HOME=/home/$USER
510

src/r-analysis-aou/wdl.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3+
<mime-type type="text/x-wdl">
4+
<comment>Workflow Description Language</comment>
5+
<glob pattern="*.wdl"/>
6+
</mime-type>
7+
</mime-info>

src/r-analysis/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM ghcr.io/rocker-org/devcontainer/tidyverse:4.5
2+
3+
# Register .wdl (Workflow Description Language) as a text MIME type so RStudio
4+
# opens .wdl files as text instead of misidentifying them as binary (PHP-130724).
5+
COPY wdl.xml /usr/share/mime/packages/wdl.xml
6+
RUN update-mime-database /usr/share/mime

src/r-analysis/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
services:
22
app:
33
container_name: "application-server"
4+
build:
5+
context: .
46
image: "ghcr.io/rocker-org/devcontainer/tidyverse:4.5"
57
restart: always
68
volumes:

src/r-analysis/wdl.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
3+
<mime-type type="text/x-wdl">
4+
<comment>Workflow Description Language</comment>
5+
<glob pattern="*.wdl"/>
6+
</mime-type>
7+
</mime-info>

startupscript/post-startup.sh

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -218,29 +218,6 @@ sed -i '/user_allow_other/s/^#//g' /etc/fuse.conf
218218

219219
source "${CLOUD_SCRIPT_DIR}/resource-mount.sh"
220220

221-
###############################
222-
# RStudio file type configuration
223-
###############################
224-
# Register additional file types as text to prevent RStudio from
225-
# misidentifying them as binary (PHP-130724).
226-
if command -v rstudio-server &> /dev/null; then
227-
emit "Registering additional MIME types for RStudio..."
228-
# Add WDL (Workflow Description Language) MIME type so RStudio
229-
# recognizes .wdl files as text instead of binary.
230-
cat > /usr/share/mime/packages/wdl.xml << 'MIME_EOF'
231-
<?xml version="1.0" encoding="UTF-8"?>
232-
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
233-
<mime-type type="text/x-wdl">
234-
<comment>Workflow Description Language</comment>
235-
<glob pattern="*.wdl"/>
236-
</mime-type>
237-
</mime-info>
238-
MIME_EOF
239-
if command -v update-mime-database &> /dev/null; then
240-
update-mime-database /usr/share/mime
241-
fi
242-
fi
243-
244221
###############################
245222
# cloud platform specific setup
246223
###############################

0 commit comments

Comments
 (0)