Skip to content

Commit

Permalink
[Hexa] Fix docker run
Browse files Browse the repository at this point in the history
  • Loading branch information
suibianwanwank committed Apr 26, 2024
1 parent fe0b557 commit cc31414
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
username: ${{ secrets.DOCKER_HUB_NAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: build and push hexa-fe
run: docker build -t suibianwanwan333/hexa-fe:v1.0.0 -f ./fe/Dockerfile ../ && docker push suibianwanwan333/hexa-fe:v1.0.0
run: docker build -t suibianwanwan333/hexa-fe:v1.0.0 -f ./fe/Dockerfile . && docker push suibianwanwan333/hexa-fe:v1.0.0

- name: build and push hexa-be
run: docker build -t suibianwanwan333/hexa-be:v1.0.0 -f ./be/Dockerfile ../ && docker push suibianwanwan333/hexa-be:v1.0.0
run: docker build -t suibianwanwan333/hexa-be:v1.0.0 -f ./be/Dockerfile . && docker push suibianwanwan333/hexa-be:v1.0.0

- name: build and push hexa-cli
run: docker build -t suibianwanwan333/hexa-cli:v1.0.0 -f ./cli/Dockerfile ../ && docker push suibianwanwan333/hexa-cli:v1.0.0
run: docker build -t suibianwanwan333/hexa-cli:v1.0.0 -f ./cli/Dockerfile . && docker push suibianwanwan333/hexa-cli:v1.0.0
6 changes: 3 additions & 3 deletions be/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM rust:1.75-bookworm AS be
COPY . .

# Copy in source.
WORKDIR /hexa/be
WORKDIR /be

RUN chmod +x ./docker.sh
RUN ./docker.sh
Expand All @@ -12,8 +12,8 @@ FROM debian:bookworm-slim


# Copy in built stuff.
COPY --from=be /hexa/be/target/release/hexa-be /
COPY --from=be /hexa/be/start.sh /
COPY --from=be /be/target/release/hexa-be /
COPY --from=be /be/start.sh /

RUN chmod +x ./start.sh

Expand Down
2 changes: 1 addition & 1 deletion be/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export PATH="$PWD/protoc/bin:$PATH"

protoc --version

cd /hexa/be
cd be

cargo build --bin hexa-be --release
6 changes: 3 additions & 3 deletions cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM rust:1.75-bookworm AS builder
COPY . .

# Copy in source.
WORKDIR /hexa/cli
WORKDIR /cli


RUN chmod +x ./docker.sh
Expand All @@ -13,8 +13,8 @@ FROM debian:bookworm-slim


# Copy in built stuff.
COPY --from=builder /hexa/cli/target/release/cli /cli
COPY --from=builder /hexa/cli/start.sh /
COPY --from=builder /cli/target/release/cli /cli
COPY --from=builder /cli/start.sh /

RUN chmod +x ./start.sh

Expand Down
2 changes: 1 addition & 1 deletion cli/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export PATH="$PWD/protoc/bin:$PATH"

protoc --version

cd /hexa/cli
cd /cli

cargo build --release
25 changes: 18 additions & 7 deletions fe/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,33 @@ FROM maven:3.6.3-openjdk-8 AS builder

COPY . .

WORKDIR /hexa/fe
WORKDIR /fe

RUN chmod +x ./package.sh
RUN ./package.sh


FROM openjdk:8-jre-alpine

COPY --from=builder /hexa/fe/main/target/libs/ /hexa-fe/lib/
COPY --from=builder /hexa/fe/main/target/main-1.0-SNAPSHOT.jar /hexa-fe/lib/
COPY --from=builder /hexa/fe/main/src/main/resources/ /hexa-fe/etc/
COPY --from=builder /hexa/fe/start.sh /hexa-fe/bin/
WORKDIR /fe

COPY --from=builder /fe/main/target/libs/ ./lib/
COPY --from=builder /fe/main/target/main-1.0-SNAPSHOT.jar ./lib/
COPY --from=builder /fe/main/src/main/resources/ ./etc/
COPY --from=builder /fe/start.sh ./bin/

EXPOSE 9065 8082

RUN chmod +x /hexa-fe/bin/start.sh

RUN ls
RUN pwd

CMD ["/hexa-fe/bin/start.sh"]
WORKDIR /fe/bin

RUN ls
RUN pwd

RUN chmod +x ./start.sh


CMD ["./start.sh"]
4 changes: 2 additions & 2 deletions fe/start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

cd /hexa-fe/lib
java -Dconfig=/hexa-fe/etc/config.properties -cp * com.ccsu.server.Launcher
cd /fe/lib
java -Dconfig=/fe/etc/config.properties -cp * com.ccsu.server.Launcher

0 comments on commit cc31414

Please sign in to comment.