Build container images for deployment

Signed-off-by: Adam Szkoda <adaszko@gmail.com>
This commit is contained in:
Adam Szkoda 2022-12-12 12:58:24 +01:00 committed by Alexis Sellier
parent 9186d1f30f
commit ac3ee5f709
No known key found for this signature in database
4 changed files with 51 additions and 3 deletions

41
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: Build and push container images
on:
push:
branches:
- deploy/*
jobs:
build-and-push-images:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to the container registry
uses: docker/login-action@v1
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_JSON_KEY }}
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push radicle-node
id: radicle-node
uses: docker/build-push-action@v2
with:
context: .
file: radicle-node/Dockerfile
push: true
tags: gcr.io/radicle-services/radicle-node:latest,gcr.io/radicle-services/radicle-node:${{ github.sha }}
cache-from: type=registry,ref=gcr.io/radicle-services/radicle-node:latest
cache-to: type=inline
- name: Build and push radicle-httpd
id: radicle-httpd
uses: docker/build-push-action@v2
with:
context: .
file: radicle-httpd/Dockerfile
push: true
tags: gcr.io/radicle-services/radicle-httpd:latest,gcr.io/radicle-services/radicle-httpd:${{ github.sha }}
cache-from: type=registry,ref=gcr.io/radicle-services/radicle-httpd:latest
cache-to: type=inline

View File

@ -7,6 +7,9 @@ services:
context: . context: .
environment: environment:
RUST_LOG: debug RUST_LOG: debug
RAD_PASSPHRASE: seed
volumes:
- /var/opt/radicle:/root/.radicle
init: true init: true
container_name: radicle-node container_name: radicle-node
restart: unless-stopped restart: unless-stopped
@ -16,6 +19,8 @@ services:
resources: resources:
limits: limits:
memory: 6gb memory: 6gb
ports:
- 8776:8776
radicle-httpd: radicle-httpd:
image: gcr.io/radicle-services/radicle-httpd:${RADICLE_IMAGE_TAG:-latest} image: gcr.io/radicle-services/radicle-httpd:${RADICLE_IMAGE_TAG:-latest}
build: build:
@ -23,6 +28,8 @@ services:
context: . context: .
environment: environment:
RUST_LOG: debug RUST_LOG: debug
volumes:
- /var/opt/radicle:/root/.radicle
init: true init: true
container_name: radicle-httpd container_name: radicle-httpd
restart: unless-stopped restart: unless-stopped
@ -40,7 +47,7 @@ services:
- | - |
cat <<EOF >/etc/caddy/Caddyfile cat <<EOF >/etc/caddy/Caddyfile
{$RADICLE_DOMAIN} { {$RADICLE_DOMAIN} {
reverse_proxy radicle-httpd:8778 reverse_proxy radicle-httpd:8080
} }
EOF EOF
caddy run --config /etc/caddy/Caddyfile --adapter caddyfile caddy run --config /etc/caddy/Caddyfile --adapter caddyfile

View File

@ -18,4 +18,4 @@ COPY --from=build /workdir/target/x86_64-unknown-linux-musl/container/radicle-ht
WORKDIR /app WORKDIR /app
ENTRYPOINT ["/usr/local/bin/radicle-httpd"] ENTRYPOINT ["/usr/local/bin/radicle-httpd", "--listen", "0.0.0.0:8080"]

View File

@ -19,4 +19,4 @@ COPY --from=build /workdir/target/x86_64-unknown-linux-musl/container/radicle-no
WORKDIR /app WORKDIR /app
ENTRYPOINT ["/usr/local/bin/radicle-node"] ENTRYPOINT ["/usr/local/bin/radicle-node", "--listen", "0.0.0.0:8776"]