Add openssl as rust dependency. (#108) #32
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
# NOTE: The environment of github action should be stable enough, | |
# so let's not use two stage docker build to make our life easier | |
name: Build and publish Docker image | |
on: | |
push: | |
branches: ['production'] | |
jobs: | |
fog_machine_server: | |
name: Build and publish [fog-machine-server] | |
# ubuntu-22.04 with libssl 3 seems to be too new for our docker base image | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: server | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
# An explicit cache key that is used instead of the automatic `job`-based | |
# cache key and is thus stable across jobs. | |
# Default: empty | |
shared-key: "" | |
# An additional cache key that is added alongside the automatic `job`-based | |
# cache key and can be used to further differentiate jobs. | |
# Default: empty | |
key: "" | |
# A whitespace separated list of env-var *prefixes* who's value contributes | |
# to the environment cache key. | |
# The env-vars are matched by *prefix*, so the default `RUST` var will | |
# match all of `RUSTC`, `RUSTUP_*`, `RUSTFLAGS`, `RUSTDOC_*`, etc. | |
# Default: "CARGO CC CFLAGS CXX CMAKE RUST" | |
env-vars: "" | |
# The cargo workspaces and target directory configuration. | |
# These entries are separated by newlines and have the form | |
# `$workspace -> $target`. The `$target` part is treated as a directory | |
# relative to the `$workspace` and defaults to "target" if not explicitly given. | |
# Default: ". -> target" | |
workspaces: "server" | |
# Determines if the cache should be saved even when the workflow has failed. | |
cache-on-failure: false | |
- name: Release build | |
run: cargo build --release | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: caviarc/fog-machine-server | |
tags: | | |
type=raw,value=latest | |
type=sha | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./server | |
file: ./server/github-action.Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |