Last active
May 10, 2021 15:46
-
-
Save jonasgeiler/daa3fc4c407142ee0656c1971199fd0f to your computer and use it in GitHub Desktop.
Running local JS Bin using Docker + docker-compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"timezone": "UTC", | |
"url": { | |
"host": "example.com", | |
"prefix": "/", | |
"ssl": true | |
}, | |
"max-request-size": "1MB", | |
"max-age": 86400, | |
"store": { | |
"adapter": "mysql", | |
"mysql": { | |
"host": "db", | |
"user": "jsbin", | |
"password": "jsbin-secret", | |
"database": "jsbin" | |
} | |
}, | |
"mail": { | |
"adapter": "sendmail", | |
"sendmail": {}, | |
"smtp": { | |
"service": "Gmail", | |
"auth": { | |
"user": "", | |
"pass": "" | |
} | |
} | |
}, | |
"server": { | |
"logger": "none" | |
}, | |
"security": { | |
"allowAnonymousPreview": false | |
}, | |
"session": { | |
"secret": "insertrandomkeyhere" | |
}, | |
"github": { | |
"id": "", | |
"secret": "" | |
}, | |
"api": { | |
"allowAnonymousReadWrite": false, | |
"allowAnonymousRead": true, | |
"requireSSL": true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
db: | |
image: mariadb:10.5 | |
container_name: jsbin_db | |
restart: always | |
environment: | |
- MYSQL_DATABASE=jsbin | |
- MYSQL_USER=jsbin | |
- MYSQL_PASSWORD=jsbin-secret | |
- MYSQL_RANDOM_ROOT_PASSWORD=1 | |
volumes: | |
- db_data:/var/lib/mysql | |
jsbin: | |
build: . | |
container_name: jsbin | |
ports: | |
- "3001:8000" | |
volumes: | |
- "./config.json:/config.json" | |
environment: | |
- JSBIN_CONFIG=/config.json | |
depends_on: | |
- db | |
volumes: | |
db_data: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12-alpine | |
RUN apk --no-cache add git | |
RUN git clone https://github.com/jsbin/jsbin.git /jsbin | |
WORKDIR /jsbin | |
RUN npm install -g grunt-cli | |
RUN npm install | |
RUN grunt build | |
ENV NODE_ENV=production | |
ENV PORT=8000 | |
EXPOSE 8000 | |
CMD node . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is intended to be used behind a reverse proxy (like nginx or caddy)
Usage
config.json
example.com
with your domain nameUTC+1
)docker-compose up -d
Reverse Proxy using Caddy
Example Caddyfile entry: