Skip to content
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

Refactor: Restructure Docker Configuration and Compose Setup #203

Merged
merged 2 commits into from
Dec 7, 2024
Merged
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
22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7

ARG RUST_VERSION=1.82.0
ARG APP_NAME=horizon
ARG APP_NAME=horizon-server

################################################################################
# Create a stage for building the application.
Expand All @@ -27,17 +27,17 @@ RUN apk add --no-cache clang lld musl-dev git
# Leverage a bind mount to the src directory to avoid having to copy the
# source code into the container. Once built, copy the executable to an
# output directory before the cache mounted /app/target is unmounted.
RUN --mount=type=bind,source=src,target=src \
--mount=type=bind,source=plugin-api,target=plugin-api,readonly=false \
--mount=type=bind,source=plugins,target=plugins \
--mount=type=bind,source=config.yml,target=config.yml \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
RUN --mount=type=bind,source=./server/src,target=/app/server/src \
--mount=type=bind,source=./plugin_api,target=/app/plugin_api,readonly=false \
--mount=type=bind,source=./plugins,target=/app/plugins \
--mount=type=bind,source=./server/server_config.json,target=/app/server/server_config.json \
--mount=type=bind,source=./server/Cargo.toml,target=/app/server/Cargo.toml \
--mount=type=cache,target=/app/target/ \
--mount=type=cache,target=/usr/local/cargo/git/db \
--mount=type=cache,target=/usr/local/cargo/registry/ \
cargo build --locked --release && \
cp ./target/release/$APP_NAME /bin/server
cd ./server && cargo build --release

RUN cp /app/server/target/release/horizon-server /bin/horizon-server

################################################################################
# Create a new stage for running the application that contains the minimal
Expand Down Expand Up @@ -65,10 +65,10 @@ RUN adduser \
USER appuser

# Copy the executable from the "build" stage.
COPY --from=build /bin/server /bin/
COPY --from=build /bin/$APP_NAME /bin/

# Expose the port that the application listens on.
EXPOSE 3000

# What the container should run when it is started.
CMD ["/bin/server"]
CMD ["/bin/horizon-server"]
Loading