Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
archeoss committed Sep 19, 2023
1 parent b90caf3 commit 7ab7b75
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 97 deletions.
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
address: 0.0.0.0:7000
address: 0.0.0.0:9000
logger:
trace-level: INFO
13 changes: 3 additions & 10 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@ services:
build:
context: ./
dockerfile: dockerfiles/alpine/Dockerfile
volumes:
- "./config.yaml:/config.yaml"
networks:
bobnet:
ipv4_address: 192.168.17.11
ports:
- "9000:9000"
command: "backend/backend --config-file config"
bob-gui-dev:
build:
context: ./
dockerfile: dockerfiles/alpine/Dockerfile.dev
networks:
bobnet:
ipv4_address: 192.168.17.12
ports:
- "8000:9000"
command: "--config-file /config.yaml"
networks:
bobnet:
driver: bridge
Expand Down
34 changes: 21 additions & 13 deletions dockerfiles/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,26 @@ RUN apt-get update \


# RUN USER=root cargo new --bin bob-management
COPY ./Cargo.toml ./Cargo.toml
COPY ./build.rs ./build.rs
COPY ./cli ./cli
COPY ./backend ./backend
COPY ./.cargo ./.cargo
RUN cargo backend --profile=$BUILD_PROFILE --target=$BUILD_TARGET
RUN mkdir -p backend/src frontend cli/src
RUN mkdir target
COPY Cargo.toml Cargo.toml
COPY cli/Cargo.toml cli/Cargo.toml
COPY backend/Cargo.toml backend/Cargo.toml
COPY frontend/Cargo.toml frontend/Cargo.toml
COPY .cargo .cargo
RUN echo "fn main() {println!(\"if you see this, the build broke\")}" > backend/src/lib.rs \
&& echo "fn main() {println!(\"if you see this, the build broke\")}" > backend/src/main.rs \
&& echo "fn main() {println!(\"if you see this, the build broke\")}" > frontend/build.rs \
&& echo "fn main() {println!(\"if you see this, the build broke\")}" > cli/src/lib.rs \
&& echo "fn main() {println!(\"if you see this, the build broke\")}" > build.rs \
&& cargo build -p bob_management --features backend --no-default-features --profile=$BUILD_PROFILE --target=$BUILD_TARGET

ADD . ./

RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/home/root/app/target \
cargo backend --profile=$BUILD_PROFILE --target=$BUILD_TARGET \
RUN \
# --mount=type=cache,target=/usr/local/cargo/registry \
# --mount=type=cache,target=/home/root/app/target \
cargo build -p bob_management --features backend --no-default-features --profile=$BUILD_PROFILE --target=$BUILD_TARGET \
&& mkdir /build_output \
&& cp -f target/$BUILD_TARGET/$BUILD_PROFILE/backend /build_output/backend

Expand All @@ -40,7 +48,7 @@ FROM alpine:3.18
ARG APP=/usr/src/app
ENV TZ=Etc/UTC \
APP_USER=appuser

ENV PATH="$PATH:${APP}"
RUN addgroup -S $APP_USER \
&& adduser -S -g $APP_USER $APP_USER \
&& apk update \
Expand All @@ -49,11 +57,11 @@ RUN addgroup -S $APP_USER \

EXPOSE 9000

COPY --from=backend --chown=$APP_USER:$APP_USER /build_output/backend ${APP}/backend/backend
COPY --from=frontend --chown=$APP_USER:$APP_USER /frontend/dist ${APP}/frontend
COPY --from=backend --chown=$APP_USER:$APP_USER /build_output/backend ${APP}/backend
COPY --from=frontend --chown=$APP_USER:$APP_USER /frontend/dist ${APP}/dist

USER $APP_USER
WORKDIR ${APP}

CMD ["./backend/backend"]
ENTRYPOINT ["./backend"]

73 changes: 0 additions & 73 deletions dockerfiles/alpine/Dockerfile.dev

This file was deleted.

0 comments on commit 7ab7b75

Please sign in to comment.