-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to deploy docker containers (#138)
- Loading branch information
1 parent
d61f669
commit 0eda147
Showing
5 changed files
with
55 additions
and
138 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,6 @@ | ||
|
||
[profile.prod] | ||
inherits = "release" | ||
debug = true | ||
lto = "thin" | ||
codegen-units = 1 |
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,35 @@ | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
is_release: | ||
default: 'true' | ||
type: boolean | ||
push: | ||
|
||
name: docker | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: [ctf, ffa, base] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: docker/setup-buildx-action@v1 | ||
|
||
- uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
tags: ghcr.io/steamroller-airmash/server:${{ matrix.target }} | ||
build-args: | | ||
TARGET=${{ matrix.target }} | ||
push: ${{ github.event.is_release == 'true' }} | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,49 +1,23 @@ | ||
FROM clux/muslrust:nightly | ||
FROM rust:1.59-slim-bullseye as build-env | ||
|
||
WORKDIR /build | ||
|
||
RUN USER=root cargo new --bin base | ||
COPY ./base/Cargo.toml ./base/Cargo.toml | ||
|
||
RUN USER=root cargo new --bin bounded-queue | ||
COPY ./bounded-queue/Cargo.toml ./bounded-queue/Cargo.toml | ||
|
||
RUN USER=root cargo new --bin ctf | ||
COPY ./ctf/Cargo.toml ./ctf/Cargo.toml | ||
|
||
RUN USER=root cargo new --bin ffa | ||
COPY ./ffa/Cargo.toml ./ffa/Cargo.toml | ||
|
||
RUN USER=root cargo new --bin server | ||
COPY ./server/Cargo.toml ./server/Cargo.toml | ||
|
||
RUN USER=root cargo new --bin special-map | ||
COPY ./special-map/Cargo.toml ./special-map/Cargo.toml | ||
|
||
COPY ./Cargo.lock ./Cargo.lock | ||
COPY ./Cargo.toml ./Cargo.toml | ||
|
||
RUN cargo build --release | ||
|
||
RUN rm ./base/src/*.rs | ||
RUN rm ./bounded-queue/src/*.rs | ||
RUN rm ./ctf/src/*.rs | ||
RUN rm ./ffa/src/*.rs | ||
RUN rm ./server/src/*.rs | ||
RUN rm ./special-map/src/*.rs | ||
RUN apt-get update \ | ||
&& apt-get install -y dwz \ | ||
&& apt-get clean | ||
|
||
WORKDIR /build | ||
COPY . /build | ||
|
||
RUN cargo build --release | ||
RUN mkdir /artifacts | ||
RUN mv target/x86_64-unknown-linux-musl/release/airmash-server-base /artifacts/airmash-server | ||
ARG TARGET | ||
|
||
FROM alpine:latest | ||
RUN cargo build --profile prod --bin airmash-server-${TARGET} | ||
RUN mv target/prod/airmash-server-${TARGET} target/airmash-server | ||
RUN dwz -L none -l none --odr target/airmash-server | ||
|
||
EXPOSE 3501 | ||
FROM debian:bullseye-slim | ||
|
||
COPY --from=0 /artifacts/airmash-server /app/airmash-server | ||
COPY --from=build-env /build/target/airmash-server / | ||
|
||
ENV RUST_LOG=info,ws=warn | ||
EXPOSE 3501/tcp | ||
ENV RUST_LOG=info | ||
|
||
ENTRYPOINT [ "/app/airmash-server" ] | ||
ENTRYPOINT [ "/airmash-server" ] |
This file was deleted.
Oops, something went wrong.