Skip to content

Commit 25074d7

Browse files
committed
Building it wo devbox
1 parent 6813508 commit 25074d7

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

.github/workflows/build-docker.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ jobs:
1212
push_to_registries:
1313
name: Push Docker image to ghcr.io
1414
runs-on: ubuntu-latest
15-
# permissions:
16-
# packages: write
17-
# contents: read
18-
# attestations: write
19-
# id-token: write
2015

2116
steps:
2217
- name: Check out the repo

Dockerfile

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
1-
FROM jetpackio/devbox:latest
2-
3-
# Installing your devbox project
4-
WORKDIR /code
5-
USER root:root
6-
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
7-
USER ${DEVBOX_USER}:${DEVBOX_USER}
8-
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
9-
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
10-
11-
RUN devbox install
12-
RUN devbox run -- echo "Installed Packages."
13-
# RUN devbox run -- echo "Installed Packages." && nix-store --gc && nix-store --optimise
14-
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} . .
15-
RUN devbox run build && nix-store --gc && nix-store --optimise
16-
17-
CMD ["devbox", "run", "serve"]
1+
FROM rust:1 AS chef
2+
RUN cargo install cargo-chef
3+
WORKDIR /app
4+
5+
FROM chef AS planner
6+
COPY . .
7+
RUN cargo chef prepare --recipe-path recipe.json
8+
9+
FROM chef AS builder
10+
COPY --from=planner /app/recipe.json recipe.json
11+
RUN cargo chef cook --release --recipe-path recipe.json
12+
COPY . .
13+
14+
# Install `dx`
15+
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
16+
RUN cargo binstall dioxus-cli --root /.cargo -y --force
17+
ENV PATH="/.cargo/bin:$PATH"
18+
19+
# Create the final bundle folder. Bundle always executes in release mode with optimizations enabled
20+
RUN dx bundle --platform web
21+
22+
FROM chef AS runtime
23+
COPY --from=builder /app/target/dx/hot_dog/release/web/ /usr/local/app
24+
25+
# set our port and make sure to listen for all connections
26+
ENV PORT=8080
27+
ENV IP=0.0.0.0
28+
29+
# expose the port 8080
30+
EXPOSE 8080
31+
32+
WORKDIR /usr/local/app
33+
ENTRYPOINT [ "/usr/local/app/server" ]

recipe.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)