Skip to content

musl docker #618 #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
target
Dockerfile
dockerfile
.dockerignore
.env
.git
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
images: joepmeneer/atomic-server
github-token: ${{ secrets.GITHUB_TOKEN }}
tags: |
# set latest tag for master branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=schedule
type=ref,event=branch
type=ref,event=pr
Expand All @@ -58,3 +60,13 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Run docker image
run: nohup docker run -p 80:80 joepmeneer/atomic-server:develop --initialize &

- name: Setup and run end-to-end tests
working-directory: ./server/e2e_tests/
run: |
pnpm install
pnpm run install-playwright
pnpm run test
22 changes: 17 additions & 5 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
FROM rust:1.67 as builder
FROM clux/muslrust:stable AS builder
# Install musl dependencies
# RUN rustup target add x86_64-unknown-linux-musl

# Cross-compiling for musl requires some specific linkers due to ring
# https://github.com/briansmith/ring/issues/1414#issuecomment-1055177218
# RUN apt update && apt install -y musl-tools clang llvm musl-dev
# ENV RUSTFLAGS='-C linker=x86_64-linux-gnu-gcc'
# ENV CC_aarch64_unknown_linux_musl=clang
# ENV AR_aarch64_unknown_linux_musl=llvm-ar
# ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld"

WORKDIR /app
COPY . .
RUN cargo build --release --bin atomic-server --config net.git-fetch-with-cli=true
RUN cargo build --release --bin atomic-server --config net.git-fetch-with-cli=true --target x86_64-unknown-linux-musl
RUN strip -s /app/target/x86_64-unknown-linux-musl/release/atomic-server

FROM scratch as runtime
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/atomic-server /atomic-server-bin

# We only need a small runtime for this step, but make sure glibc is installed
FROM frolvlad/alpine-glibc:alpine-3.16_glibc-2.34 as runtime
COPY --chmod=0755 --from=builder /app/target/release/atomic-server /atomic-server-bin
# For a complete list of possible ENV vars or available flags, run with `--help`
ENV ATOMIC_STORE_PATH="/atomic-storage/db"
ENV ATOMIC_CONFIG_PATH="/atomic-storage/config.toml"
Expand Down