Skip to content

Commit

Permalink
Improve docker workflow for local development
Browse files Browse the repository at this point in the history
commit-id:7b820d46
  • Loading branch information
tylerwowen committed Mar 1, 2024
1 parent e6f3e13 commit da05f6b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions deploy-service/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/target
12 changes: 5 additions & 7 deletions deploy-service/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM maven:3.8-openjdk-8-slim AS builder

COPY . /deploy-service

RUN cd /deploy-service && mvn clean package -DskipTests
RUN --mount=type=cache,target=/m2 \
cd /deploy-service && mvn package -DskipTests -Dmaven.repo.local=/m2 -Dassembly.skipAssembly=true

FROM openjdk:8

Expand All @@ -11,10 +12,7 @@ ENV PROJECT_DIR=/opt/deploy-service
RUN mkdir $PROJECT_DIR
WORKDIR $PROJECT_DIR

COPY --from=builder /deploy-service/teletraanservice/target/teletraan-service-0.1-SNAPSHOT-bin.tar.gz $PROJECT_DIR
RUN tar zxf teletraan-service-0.1-SNAPSHOT-bin.tar.gz
COPY ./teletraanservice $PROJECT_DIR/teletraanservice
COPY --from=builder /deploy-service/teletraanservice/target $PROJECT_DIR/teletraanservice
COPY teletraanservice/bin $PROJECT_DIR/teletraanservice/bin

# Default command to run service, do not override it unless for staging run.
# Use "docker logs ID" to view stdout and stderr
CMD ["scripts/run_in_container.sh"]
CMD ["teletraanservice/bin/run.sh", "-c", "teletraanservice/bin/server.yaml"]
6 changes: 0 additions & 6 deletions deploy-service/teletraanservice/Dockerfile

This file was deleted.

2 changes: 2 additions & 0 deletions deploy-service/teletraanservice/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ function server_start {
com.pinterest.teletraan.TeletraanService \
server ${CONFIG_FILE}"

echo $OPTS

if [ "$1" == "FOREGROUND" ]
then
${JAVA_CMD} ${OPTS}
Expand Down

0 comments on commit da05f6b

Please sign in to comment.