Skip to content

Commit

Permalink
fix: add user
Browse files Browse the repository at this point in the history
  • Loading branch information
kristof-mattei committed Jun 8, 2022
1 parent 4734616 commit 4e414de
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 59 deletions.
102 changes: 53 additions & 49 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,53 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'rust-end-to-end-application'",
"cargo": {
"args": [
"build",
"--bin=rust-end-to-end-application",
"--package=rust-end-to-end-application"
],
"filter": {
"name": "rust-end-to-end-application",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"RUST_LOG": "rust_end_to_end_application=trace"
}
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'rust-end-to-end-application'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=rust-end-to-end-application",
"--package=rust-end-to-end-application"
],
"filter": {
"name": "rust-end-to-end-application",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'rust-end-to-end-application'",
"cargo": {
"args": [
"build",
"--bin=rust-end-to-end-application",
"--package=rust-end-to-end-application"
],
"filter": {
"name": "rust-end-to-end-application",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"RUST_LOG": "rust_end_to_end_application=trace"
}
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'rust-end-to-end-application'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=rust-end-to-end-application",
"--package=rust-end-to-end-application"
],
"filter": {
"name": "rust-end-to-end-application",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}",
"env": {
"RUST_BACKTRACE": "1",
"RUST_LOG": "rust_end_to_end_application=trace"
}
}
]
}
22 changes: 12 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"cSpell.words": [
"clippy",
"reqwest",
],
"editor.renderFinalNewline": true,
"editor.trimAutoWhitespace": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
}
{
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/target": true,
},
"editor.renderFinalNewline": true,
"editor.trimAutoWhitespace": true,
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
}
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@ COPY Cargo.toml Cargo.lock ./
RUN --mount=type=cache,target=/build/rust-end-to-end-application/target \
cargo build --release --target ${TARGET}


# now we copy in the source which is more prone to changes and build it
COPY src ./src
# --release not needed, it is implied with install
RUN --mount=type=cache,target=/build/rust-end-to-end-application/target \
cargo install --path . --target ${TARGET} --root /output

FROM alpine:3.16.0@sha256:686d8c9dfa6f3ccfc8230bc3178d23f84eeaf7e457f36f271ab1acc53015037c

RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser

WORKDIR /app
COPY --from=builder /output/bin/rust-end-to-end-application /app
USER user
ENTRYPOINT ["/app/rust-end-to-end-application"]

0 comments on commit 4e414de

Please sign in to comment.