mirror of
https://github.com/dmuth/diceware.git
synced 2024-12-03 12:53:58 -05:00
commit
1dc0547ee0
6 changed files with 86 additions and 0 deletions
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
FROM node:20-bullseye-slim as builder
|
||||
|
||||
RUN mkdir /tmp/diceware
|
||||
COPY . /tmp/diceware/
|
||||
WORKDIR /tmp/diceware
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.25-bullseye
|
||||
|
||||
COPY --from=builder /tmp/diceware/assets /usr/share/nginx/html/assets/
|
||||
COPY --from=builder /tmp/diceware/dist /usr/share/nginx/html/dist/
|
||||
COPY --from=builder /tmp/diceware/fonts /usr/share/nginx/html/fonts
|
||||
COPY --from=builder /tmp/diceware/favicon.ico /usr/share/nginx/html/favicon.ico
|
||||
COPY --from=builder /tmp/diceware/index.html /usr/share/nginx/html/index.html
|
||||
COPY --from=builder /tmp/diceware/robots.txt /usr/share/nginx/html/robots.txt
|
||||
|
||||
RUN chmod -R a+rX /usr/share/nginx/html
|
||||
|
10
README.md
10
README.md
|
@ -91,6 +91,16 @@ A local webserver can be set up by running `npm install http-server -g` to insta
|
|||
- `gh release upload v1.0.1 diceware.zip` to upload the ZIP file containing everything
|
||||
|
||||
|
||||
## Development In Docker
|
||||
|
||||
Wanna develop in Docker? We got you covered. Here are some helper scripts:
|
||||
|
||||
- `bin/docker-build.sh` - Build the Docker copntainer
|
||||
- `bin/docker-dev.sh` - Run in dev mode--listening on http://localhost:8000/
|
||||
- `bin/docker-prod.sh` - Run in prod mode--listening on http://localhost:80/
|
||||
- `bin/docker-push.sh` - Push to Docker Hub
|
||||
|
||||
|
||||
# Who built this? / Contact
|
||||
|
||||
My name is Douglas Muth, and I am a software engineer in Philadelphia, PA.
|
||||
|
|
13
bin/docker-build.sh
Executable file
13
bin/docker-build.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Build our Docker image.
|
||||
#
|
||||
|
||||
# Errors are fatal
|
||||
set -e
|
||||
|
||||
# Change to the parent directory of this script
|
||||
pushd $(dirname $0)/.. > /dev/null
|
||||
|
||||
docker build -t diceware . -f ./Dockerfile
|
||||
|
16
bin/docker-dev.sh
Executable file
16
bin/docker-dev.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to run the script in dev mode, which will spawn a shell
|
||||
#
|
||||
|
||||
# Errors are fatal
|
||||
set -e
|
||||
|
||||
# Change to the parent directory
|
||||
pushd $(dirname $0)/.. > /dev/null
|
||||
|
||||
PORT=${PORT:=8000}
|
||||
|
||||
docker run --rm -it -p ${PORT}:80 -v $(pwd):/mnt diceware
|
||||
|
||||
|
13
bin/docker-prod.sh
Executable file
13
bin/docker-prod.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Script to run the script in prod mode
|
||||
#
|
||||
|
||||
# Errors are fatal
|
||||
set -e
|
||||
|
||||
# Change to the parent directory
|
||||
pushd $(dirname $0)/.. > /dev/null
|
||||
|
||||
docker run --rm -p 80:80 diceware
|
||||
|
15
bin/docker-push.sh
Executable file
15
bin/docker-push.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Push our Docker image our Docker Hub.
|
||||
#
|
||||
|
||||
# Errors are fatal
|
||||
set -e
|
||||
|
||||
# Change to the parent directory of this script
|
||||
pushd $(dirname $0)/.. > /dev/null
|
||||
|
||||
docker tag diceware dmuth1/diceware
|
||||
docker push dmuth1/diceware
|
||||
|
||||
|
Loading…
Reference in a new issue