Skip to content

Commit fb98ed2

Browse files
authored
Merge pull request #5 from noprd/staging
Staging ---> Main
2 parents d592a60 + a444089 commit fb98ed2

File tree

10 files changed

+55
-16
lines changed

10 files changed

+55
-16
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# ----------------------------------------------------------------
99

1010
!/README.md
11+
!/ISSUES.md
1112
!/LICENCE
1213
!/justfile
1314
!/Cargo.toml

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "example-rust"
3-
version = "0.0.0"
3+
version = "0.0.0-a"
44
edition = "2021"
55
rust-version = "1.80.1"
66
authors = [

Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FROM rust:1.80.1-slim AS stage-basic
66

77
ARG USER
88
ARG APP
9-
ARG WORKDIR
9+
ARG WD
1010
ARG HTTP_IP
1111
ARG HTTP_PORT
1212
ARG HTTP_USER
@@ -21,11 +21,11 @@ RUN groupadd --gid 999 ${USER} \
2121
&& useradd --uid 1001 --gid 999 --create-home ${USER}
2222

2323
# Running instance should own the code, as task automation leads to changes.
24-
COPY . ${WORKDIR}
25-
RUN chown -R ${USER}:${USER} ${WORKDIR}
24+
COPY . ${WD}
25+
RUN chown -R ${USER}:${USER} ${WD}
2626

2727
USER root
28-
WORKDIR ${WORKDIR}
28+
WORKDIR ${WD}
2929
COPY . .
3030

3131
FROM stage-basic AS stage1

ISSUES.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Issues #
2+
3+
## Posix bug ##
4+
5+
### Description ###
6+
7+
When expanding the environment variable `WD`
8+
from [docker-compose.yaml](docker-compose.yaml) in [Dockerfile](Dockerfile),
9+
and running `docker compose up --build -d ...`
10+
(see [justfile](justfile) > command: `just docker-build`)
11+
paths like `/usr/home/myapp` would be bafflingly
12+
replaced by `C:/Program Files/Git/usr/home/myapp`.
13+
14+
### Diagnosis ###
15+
16+
This bug occurs on Windows when using the Git Bash console
17+
as is a known issue, see <https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md>.
18+
19+
### Solution ###
20+
21+
Whilst there a new release of Git Bash may solve this issue,
22+
a work around that work with older versions is to simply replace
23+
24+
```.env
25+
DOCKER_WORKDIR="/usr/home/${DOCKER_APP}"
26+
```
27+
28+
via
29+
30+
```.env
31+
DOCKER_WORKDIR="//usr/home/${DOCKER_APP}"
32+
```
33+
34+
in the [.env](templates/template.env) file.
35+
By replacing `//` by `/`, such forced expansions are avoided.

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,12 @@ docker system prune
146146
147147
> [!WARNING]
148148
> The latter command clears _all_ docker images, containers, etc.
149-
> not just for this project.
149+
> not just for this project##
150+
151+
## References ##
152+
153+
Some of the source code (see [src/main.rs](src/main.rs))
154+
was initially adapted from the code in [@alfredodeza/rust-azure-function](https://github.com/alfredodeza/rust-azure-function).
155+
In our repository, we refactored this and took things in a completely different direction.
156+
We wrote the task scripts ([justfile](justfile)),
157+
docker infrastructure, etc. completely independently.

dist/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.0
1+
0.0.0-a

docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
args:
2323
USER: "${DOCKER_USER}"
2424
APP: "${DOCKER_APP}"
25-
WORKDIR: "${DOCKER_WORKDIR}"
25+
WD: "${DOCKER_WORKDIR}"
2626
HTTP_IP: "0.0.0.0"
2727
# NOTE: only this is different
2828
HTTP_PORT: ${DOCKER_PORT_CONTAINER}

justfile

-6
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ setup:
103103
@mkdir -p ".vscode"
104104
@- cp -n "templates/template.env" ".env"
105105
@- cp -n "templates/template-config.yaml" "setup/config.yaml"
106-
@- cp -n "templates/template-extensions.json" ".vscode/extensions.json"
107-
@- cp -n "templates/template-launch.json" ".vscode/launch.json"
108-
@- cp -n "templates/template-settings.json" ".vscode/settings.json"
109-
@- cp -n "templates/template-tasks.json" ".vscode/tasks.json"
110-
@- cp -n "templates/template-host.json" "host.json"
111-
@- cp -n "templates/template-local.settings.json" "local.settings.json"
112106

113107
build:
114108
@echo "TASK: BUILD"

templates/template.env

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ HTTP_PASSWORD="test1234"
2020

2121
DOCKER_CONTAINER="example_rust"
2222
DOCKER_APP="${PROJECT_NAME}"
23-
DOCKER_WORKDIR="/usr/home/${DOCKER_APP}"
23+
# NOTE: '//' only necessary on windows to avoid a posix bug which expands paths in an undesirable way
24+
DOCKER_WORKDIR="//usr/home/${DOCKER_APP}"
2425
DOCKER_USER="nops"
2526
DOCKER_PORT_HOST=${HTTP_PORT}
2627
DOCKER_PORT_CONTAINER=8000

0 commit comments

Comments
 (0)