Skip to content

Commit

Permalink
feat: provide docker build step
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Valdes committed Dec 21, 2024
1 parent 83c2344 commit 1d290c3
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
34 changes: 19 additions & 15 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,25 @@ jobs:
runs-on: ubuntu-latest

steps:
# Step 1. Checkout the Repository
- name: Checkout code
uses: actions/checkout@v3

# Step 2. Build Docker Images
# - name: Build Docker Images
# run: |
# docker-compose -f docker-compose.yml build

# Step 3. Push Docker Images (Optional, only for main branch)
# - name: Push Docker Images
# if: github.ref == 'refs/heads/main'
# env:
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# run: |
# echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
# docker-compose -f docker-compose.yml push
- name: Build Docker Images
run: |
docker compose -f docker-compose.yml build
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker images
run: |
docker compose -f docker-compose.yml push
2 changes: 1 addition & 1 deletion Dockerfile.click-persister
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ RUN apt-get update && apt-get install -y \
libssl3 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

LABEL org.opencontainers.image.source https://github.com/valdo404/clickplanet-rust
COPY --from=builder /usr/src/app/target/release/state-click-persister ./

COPY countries.geojson \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.click-server
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN cargo build --release --bin click-server
FROM debian:bookworm-slim

WORKDIR /app
LABEL org.opencontainers.image.source https://github.com/valdo404/clickplanet-rust

RUN apt-get update && apt-get install -y \
libssl3 \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.tile-syncer-robot
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN cargo build --release --bin tile-syncer
FROM debian:bookworm-slim

WORKDIR /app
LABEL org.opencontainers.image.source https://github.com/valdo404/clickplanet-rust

RUN apt-get update && apt-get install -y \
libssl3 \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.watchguard-robot
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/src/app/target/release/country-watchguard ./
LABEL org.opencontainers.image.source https://github.com/valdo404/clickplanet-rust

COPY countries.geojson \
tile_to_countries.json \
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ services:
build:
context: ./
dockerfile: Dockerfile.click-server
image: clickplanet/click-server:latest
image: ghcr.io/valdo404/clickplanet-rust-state-click-server:latest
environment:
- RUST_LOG=debug
command: [
Expand All @@ -80,7 +80,7 @@ services:
build:
context: ./
dockerfile: Dockerfile.click-persister
image: clickplanet/state-click-persister:latest
image: ghcr.io/valdo404/clickplanet-rust-state-click-persister:latest
environment:
- RUST_LOG=debug
command: [
Expand All @@ -105,7 +105,7 @@ services:
build:
context: ./
dockerfile: Dockerfile.tile-syncer-robot
image: clickplanet/tile-syncer:latest
image: ghcr.io/valdo404/clickplanet-rust-tile-syncer:latest
environment:
- RUST_LOG=debug
command: [
Expand Down

0 comments on commit 1d290c3

Please sign in to comment.