-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61783f5
commit aa24e5a
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target/ | ||
LICENSE.md | ||
README.md | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Docker Image CI for GHCR | ||
|
||
on: | ||
push: | ||
branches: | ||
- production | ||
|
||
jobs: | ||
build_and_publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
run: echo "${{ secrets.GH_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Build the Docker image | ||
run: docker build . -t ghcr.io/heliosshieldproject/${{ github.repository }}:${{ github.sha }} | ||
|
||
- name: Push the Docker image | ||
run: docker push ghcr.io/heliosshieldproject/${{ github.repository }}:${{ github.sha }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM clux/muslrust:stable AS chef | ||
ARG LOGGER_PORT | ||
RUN cargo install cargo-chef | ||
WORKDIR /logger | ||
|
||
FROM chef AS planner | ||
COPY . . | ||
CMD [ "mv", ".env.production", ".env" ] | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM chef AS builder | ||
COPY --from=planner /logger/recipe.json recipe.json | ||
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json | ||
COPY . . | ||
CMD [ "mv", ".env.production", ".env" ] | ||
RUN cargo build --release --target x86_64-unknown-linux-musl | ||
|
||
FROM scratch | ||
LABEL org.opencontainers.image.source https://github.com/HeliosShieldProject/logger-rust | ||
COPY --from=builder /logger/target/x86_64-unknown-linux-musl/release/logger /logger | ||
COPY --from=builder /logger/.env.production .env | ||
ENTRYPOINT ["/logger"] | ||
EXPOSE $LOGGER_PORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: "logger" | ||
|
||
services: | ||
logger: | ||
build: | ||
context: . | ||
args: | ||
- LOGGER_PORT=${LOGGER_PORT} | ||
dockerfile: Dockerfile | ||
ports: | ||
- "${LOGGER_PORT}:${LOGGER_PORT}" | ||
env_file: | ||
- .env.production | ||
depends_on: | ||
- logs-database | ||
networks: | ||
- logger-network | ||
|
||
logs-database: | ||
image: mongo | ||
restart: always | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: ${LOGS_DATABASE_USER} | ||
MONGO_INITDB_ROOT_PASSWORD: ${LOGS_DATABASE_PASSWORD} | ||
volumes: | ||
- logs-database-volume:/data/db | ||
command: | ||
- --port | ||
- ${LOGS_DATABASE_PORT} | ||
ports: | ||
- "${LOGS_DATABASE_PORT}:${LOGS_DATABASE_PORT}" | ||
env_file: | ||
- .env.production | ||
networks: | ||
- logger-network | ||
|
||
logs-viewer: | ||
image: mongo-express | ||
restart: always | ||
ports: | ||
- ${LOGS_VIEWER_PORT}:8081 | ||
environment: | ||
ME_CONFIG_MONGODB_URL: ${MONGO_URL} | ||
ME_CONFIG_OPTIONS_EDITORTHEME: nord | ||
ME_CONFIG_BASICAUTH_USERNAME: ${LOGS_VIEWER_USER} | ||
ME_CONFIG_BASICAUTH_PASSWORD: ${LOGS_VIEWER_PASSWORD} | ||
env_file: | ||
- .env.production | ||
depends_on: | ||
- logs-database | ||
networks: | ||
- logger-network | ||
|
||
volumes: | ||
logs-database-volume: | ||
|
||
networks: | ||
logger-network: | ||
external: true |