Skip to content

Commit

Permalink
feat: optimized docker file (#8)
Browse files Browse the repository at this point in the history
* chore: optimized docker file

* chore: version update

* chore: version update & docker fix

* chore: remove arm/v7
  • Loading branch information
stephane-segning authored Jan 22, 2025
1 parent 327ddbe commit 8248ee8
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.github
.idea
helm
scripts
.dockerignore
.gitignore
compose.yaml
target
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: "${{ github.ref == 'refs/heads/main' && 'true' || 'false' }}"
push: "true"
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new

Expand Down
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ COPY ./ ./

RUN cargo build --manifest-path wazuh-cert-oauth2/Cargo.toml --release

FROM base
FROM debian:12 as dep

RUN apt-get update && apt-get install -y gcc

# Dependencies for libpq (used by
RUN mkdir /deps && \
cp /usr/lib/*-linux-gnu/libgcc_s.so.* /deps

FROM gcr.io/distroless/base-debian12:nonroot

LABEL maintainer="[email protected]"
LABEL org.opencontainers.image.description="adorsys Cameroon"

ENV RUST_LOG=warn

WORKDIR /app

COPY --from=builder /app/wazuh-cert-oauth2/target/release/wazuh-cert-oauth2 /app/wazuh-cert-oauth2
COPY --from=dep /deps /usr/lib/

EXPOSE 8000

Expand Down
7 changes: 7 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
oauth2:
build:
context: .
dockerfile: ./Dockerfile
ports:
- "8000:8000"
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.11
version: 0.2.14

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $ErrorActionPreference = "Stop"
# Default log level and application details
$LOG_LEVEL = if ($env:LOG_LEVEL -ne $null) { $env:LOG_LEVEL } else { "INFO" }
$APP_NAME = if ($env:APP_NAME -ne $null) { $env:APP_NAME } else { "wazuh-cert-oauth2-client" }
$DEFAULT_WOPS_VERSION = "0.2.12"
$DEFAULT_WOPS_VERSION = "0.2.14"
$WOPS_VERSION = if ($env:WOPS_VERSION -ne $null) { $env:WOPS_VERSION } else { $DEFAULT_WOPS_VERSION }
$OSSEC_CONF_PATH = if ($env:OSSEC_CONF_PATH -ne $null) { $env:OSSEC_CONF_PATH } else { "C:\Program Files (x86)\ossec-agent\ossec.conf" }
$USER = "root"
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fi
# Default log level and application details
LOG_LEVEL=${LOG_LEVEL:-INFO}
APP_NAME=${APP_NAME:-"wazuh-cert-oauth2-client"}
WOPS_VERSION=${WOPS_VERSION:-"0.2.13"}
WOPS_VERSION=${WOPS_VERSION:-"0.2.14"}
USER="root"
GROUP="wazuh"

Expand Down
4 changes: 2 additions & 2 deletions wazuh-cert-oauth2-client/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wazuh-cert-oauth2-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2-client"
version = "0.2.13"
version = "0.2.14"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion wazuh-cert-oauth2-model/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wazuh-cert-oauth2-model/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wazuh-cert-oauth2-model"
version = "0.2.11"
version = "0.2.14"
edition = "2021"

[dependencies]
Expand Down
6 changes: 2 additions & 4 deletions wazuh-cert-oauth2/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions wazuh-cert-oauth2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
[package]
name = "wazuh-cert-oauth2"
version = "0.2.11"
version = "0.2.14"
edition = "2021"

[dependencies]
tokio = { version = "1.38.1", features = ["full"] }
anyhow = "1.0.86"
thiserror = { version = "1.0.62" }
log = "0.4.22"
env_logger = "0.11.3"
rocket = { version = "0.5.1", features = ["tls", "json", "http2"] }
reqwest = { version = "0", features = ["json"] }
Expand All @@ -16,7 +15,6 @@ openssl = "0.10.66"
rand = "0.8.5"
wazuh-cert-oauth2-model = { path = "../wazuh-cert-oauth2-model" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[default.tls]
certs = "/usr/share/wazuh-cert-oauth2/certs/cert.pem"
Expand Down

0 comments on commit 8248ee8

Please sign in to comment.