Skip to content

Commit

Permalink
Try to reduce the feedback loop time with local docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Brown committed Nov 4, 2024
1 parent 1140e2f commit 766ee40
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ RUN mv robots-disallow.txt ./static/robots.txt
RUN npm run build:graphql

# Expose the app port
EXPOSE 8080
EXPOSE 4173

# Build project
RUN npm run build
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"prepare": "husky install",
"postinstall": "./scripts/install-twemoji-assets.sh",
"build:graphql": "./scripts/build-gql-types.sh",
"analyze-unused-code": "knip"
"analyze-unused-code": "knip",
"docker:build": "./scripts/docker-build.sh",
"docker:run": "docker run -t -i -p 4173:4173 drips-app"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.2",
Expand Down
10 changes: 10 additions & 0 deletions scripts/docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# cd to the scripts directory
cd "$(dirname "$(realpath -- "$0")")"
# print the current directory
pwd
# echo the command we're about to run
echo $(./docker-buildargs.sh ../.env)
# run the command
docker build $(./docker-buildargs.sh ../.env) ../. -t drips-app --platform=linux/amd64
4 changes: 4 additions & 0 deletions scripts/docker-buildargs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# !/bin/bash

# Given an env file, remove blank lines and comments and turn those lines into build args.
grep -v -e '^[[:space:]]*$' -e '^#' $@ | awk '{ sub ("\\\\$", " "); printf " --build-arg %s", $0 } END { print "" }'

0 comments on commit 766ee40

Please sign in to comment.