Skip to content

Commit 6576629

Browse files
author
Vianpyro
committed
Add development container configuration and update Dockerfile for permissions
1 parent 099260b commit 6576629

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

.devcontainer/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM alpine:latest
2+
3+
# Install common tools
4+
RUN apk add --no-cache bash git \
5+
mariadb mariadb-client
6+
7+
# Setup default user
8+
ARG USERNAME=vscode
9+
ARG USER_UID=1000
10+
ARG USER_GID=$USER_UID
11+
12+
RUN addgroup -g $USER_GID -S $USERNAME && \
13+
adduser -u $USER_UID -S -G $USERNAME -s /bin/bash $USERNAME
14+
15+
# Switch to the default user
16+
USER $USERNAME

.devcontainer/devcontainer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Smart Cooking Database Development Container",
3+
"dockerFile": "Dockerfile",
4+
"customizations": {
5+
"settings": {
6+
"terminal.integrated.shell.linux": "/bin/bash"
7+
},
8+
"vscode": {
9+
"extensions": [
10+
"mtxr.sqltools-driver-mysql"
11+
]
12+
}
13+
},
14+
"postStartCommand": "ls -l && bash ./organize-sql.sh",
15+
"remoteUser": "vscode"
16+
}

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
* text=auto
12
*.sql linguist-language=sql
23
*.sql linguist-detectable=true

Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ RUN find "${TEMP_SQL_DIR:?}/" -type f -name "*.sql" | while read -r file; do \
2020
done && \
2121
rm -rf "${TEMP_SQL_DIR:?}/"
2222

23-
# Set ownership
24-
RUN chown -R dbuser:dbuser /docker-entrypoint-initdb.d
25-
26-
# Adjust permissions on the MySQL data directory
27-
RUN chown -R dbuser:dbuser /var/lib/mysql /etc/mysql
23+
# Set ownership and adjust permissions on the MySQL data directory
24+
RUN chown -R dbuser:dbuser /docker-entrypoint-initdb.d && \
25+
chown -R dbuser:dbuser /var/lib/mysql /etc/mysql
2826

2927
# Expose the default MariaDB port (3306)
3028
EXPOSE 3306

0 commit comments

Comments
 (0)