Skip to content

Commit 9caf4bf

Browse files
committed
Misc changes.
Some small changes in general: - Moved the SQL Version check struct into the function. - Updated hadolint to 2.0.0 - Fixed hadolint 2.0.0 warnings - Updated github workflows - Added .editorconfig for some general shared editor settings.
1 parent 9b2234f commit 9caf4bf

File tree

12 files changed

+47
-23
lines changed

12 files changed

+47
-23
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ target
44
# Data folder
55
data
66
.env
7+
.env.template
8+
.gitattributes
79

810
# IDE files
911
.vscode

.editorconfig

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
charset = utf-8
9+
10+
[*.{rs,py}]
11+
indent_style = space
12+
indent_size = 4
13+
trim_trailing_whitespace = true
14+
insert_final_newline = true
15+
16+
[*.{yml,yaml}]
17+
indent_style = space
18+
indent_size = 2
19+
trim_trailing_whitespace = true
20+
insert_final_newline = true
21+
22+
[Makefile]
23+
indent_style = tab

.github/workflows/build.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@ name: Build
22

33
on:
44
push:
5-
# Ignore when there are only changes done too one of these paths
6-
paths-ignore:
7-
- "**.md"
8-
- "**.txt"
9-
- "azure-pipelines.yml"
10-
- "docker/**"
11-
- "hooks/**"
12-
- "tools/**"
135
pull_request:
146
# Ignore when there are only changes done too one of these paths
157
paths-ignore:
168
- "**.md"
179
- "**.txt"
10+
- ".dockerignore"
11+
- ".env.template"
12+
- ".gitattributes"
13+
- ".gitignore"
1814
- "azure-pipelines.yml"
1915
- "docker/**"
2016
- "hooks/**"
2117
- "tools/**"
18+
- ".github/FUNDING.yml"
19+
- ".github/ISSUE_TEMPLATE/**"
2220

2321
jobs:
2422
build:

.github/workflows/hadolint.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Hadolint
22

33
on:
4+
push:
45
pull_request:
56
# Ignore when there are only changes done too one of these paths
67
paths:
@@ -24,7 +25,7 @@ jobs:
2425
sudo curl -L https://github.com/hadolint/hadolint/releases/download/v$HADOLINT_VERSION/hadolint-$(uname -s)-$(uname -m) -o /usr/local/bin/hadolint && \
2526
sudo chmod +x /usr/local/bin/hadolint
2627
env:
27-
HADOLINT_VERSION: 1.19.0
28+
HADOLINT_VERSION: 2.0.0
2829
# End Download hadolint
2930

3031
# Test Dockerfiles

docker/Dockerfile.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ EXPOSE 3012
250250

251251
# Copies the files from the context (Rocket.toml file and web-vault)
252252
# and the binary from the "build" stage to the current stage
253+
WORKDIR /
253254
COPY Rocket.toml .
254255
COPY --from=vault /web-vault ./web-vault
255256
{% if package_arch_target is defined %}
@@ -264,6 +265,5 @@ COPY docker/start.sh /start.sh
264265
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
265266

266267
# Configures the startup!
267-
WORKDIR /
268268
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
269269
CMD ["/start.sh"]

docker/amd64/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ EXPOSE 3012
9898

9999
# Copies the files from the context (Rocket.toml file and web-vault)
100100
# and the binary from the "build" stage to the current stage
101+
WORKDIR /
101102
COPY Rocket.toml .
102103
COPY --from=vault /web-vault ./web-vault
103104
COPY --from=build /app/target/release/bitwarden_rs .
@@ -108,6 +109,5 @@ COPY docker/start.sh /start.sh
108109
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
109110

110111
# Configures the startup!
111-
WORKDIR /
112112
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
113113
CMD ["/start.sh"]

docker/amd64/Dockerfile.alpine

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ EXPOSE 3012
9393

9494
# Copies the files from the context (Rocket.toml file and web-vault)
9595
# and the binary from the "build" stage to the current stage
96+
WORKDIR /
9697
COPY Rocket.toml .
9798
COPY --from=vault /web-vault ./web-vault
9899
COPY --from=build /app/target/x86_64-unknown-linux-musl/release/bitwarden_rs .
@@ -103,6 +104,5 @@ COPY docker/start.sh /start.sh
103104
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
104105

105106
# Configures the startup!
106-
WORKDIR /
107107
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
108108
CMD ["/start.sh"]

docker/arm64/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ EXPOSE 3012
144144

145145
# Copies the files from the context (Rocket.toml file and web-vault)
146146
# and the binary from the "build" stage to the current stage
147+
WORKDIR /
147148
COPY Rocket.toml .
148149
COPY --from=vault /web-vault ./web-vault
149150
COPY --from=build /app/target/aarch64-unknown-linux-gnu/release/bitwarden_rs .
@@ -154,6 +155,5 @@ COPY docker/start.sh /start.sh
154155
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
155156

156157
# Configures the startup!
157-
WORKDIR /
158158
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
159159
CMD ["/start.sh"]

docker/armv6/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ EXPOSE 3012
144144

145145
# Copies the files from the context (Rocket.toml file and web-vault)
146146
# and the binary from the "build" stage to the current stage
147+
WORKDIR /
147148
COPY Rocket.toml .
148149
COPY --from=vault /web-vault ./web-vault
149150
COPY --from=build /app/target/arm-unknown-linux-gnueabi/release/bitwarden_rs .
@@ -154,6 +155,5 @@ COPY docker/start.sh /start.sh
154155
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
155156

156157
# Configures the startup!
157-
WORKDIR /
158158
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
159159
CMD ["/start.sh"]

docker/armv7/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ EXPOSE 3012
144144

145145
# Copies the files from the context (Rocket.toml file and web-vault)
146146
# and the binary from the "build" stage to the current stage
147+
WORKDIR /
147148
COPY Rocket.toml .
148149
COPY --from=vault /web-vault ./web-vault
149150
COPY --from=build /app/target/armv7-unknown-linux-gnueabihf/release/bitwarden_rs .
@@ -154,6 +155,5 @@ COPY docker/start.sh /start.sh
154155
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
155156

156157
# Configures the startup!
157-
WORKDIR /
158158
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
159159
CMD ["/start.sh"]

docker/armv7/Dockerfile.alpine

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ EXPOSE 3012
9999

100100
# Copies the files from the context (Rocket.toml file and web-vault)
101101
# and the binary from the "build" stage to the current stage
102+
WORKDIR /
102103
COPY Rocket.toml .
103104
COPY --from=vault /web-vault ./web-vault
104105
COPY --from=build /app/target/armv7-unknown-linux-musleabihf/release/bitwarden_rs .
@@ -109,6 +110,5 @@ COPY docker/start.sh /start.sh
109110
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
110111

111112
# Configures the startup!
112-
WORKDIR /
113113
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
114114
CMD ["/start.sh"]

src/db/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,15 @@ pub fn backup_database() -> Result<(), Error> {
241241
}
242242

243243

244-
use diesel::sql_types::Text;
245-
#[derive(QueryableByName,Debug)]
246-
struct SqlVersion {
247-
#[sql_type = "Text"]
248-
version: String,
249-
}
250-
251244
/// Get the SQL Server version
252245
pub fn get_sql_server_version(conn: &DbConn) -> String {
246+
use diesel::sql_types::Text;
247+
#[derive(QueryableByName)]
248+
struct SqlVersion {
249+
#[sql_type = "Text"]
250+
version: String,
251+
}
252+
253253
db_run! {@raw conn:
254254
postgresql, mysql {
255255
match diesel::sql_query("SELECT version() AS version;").get_result::<SqlVersion>(conn).ok() {

0 commit comments

Comments
 (0)