Last active
June 25, 2017 07:05
-
-
Save shatil/307b74522dbab945fcbbc2880261d55e to your computer and use it in GitHub Desktop.
Docker Compose to build a single service w/o Dockerfile
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
services: | |
8u121-jre-alpine: | |
command: | |
- /entrypoint.sh | |
ports: | |
- '9000:9000' | |
- '9443:9443' | |
image: openjdk:8u121-jre-alpine | |
volumes: | |
- ./entrypoint.sh:/entrypoint.sh:ro | |
- ./svc:/svc:ro | |
version: '3' |
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
#!/usr/bin/env sh | |
# Generic entrypoint.sh for all containers. | |
set -ex | |
trap 'echo "Client shutting down" && exit' INT TERM | |
pacman=exit | |
if [ -x /sbin/apk ] ; then | |
pacman='apk --no-cache add' | |
elif [ -x /usr/bin/yum ]; then | |
# Amazon Linux (Yum-based) doesn't have an OpenJDK image. | |
pacman='yum -y install java-1.8.0-openjdk-headless' | |
elif [ -x /usr/bin/apt-get ]; then | |
apt-get update | |
pacman='apt-get -y install' | |
fi | |
$pacman bash curl openssl rsync | |
# Clients won't have /svc. Play writes to this directory, so copy it. | |
cd / | |
if [ -x svc/bin/start ] ; then | |
rsync -a /svc/ /mysvc/ | |
fi | |
if [ -x /mysvc/bin/start ] ; then | |
exec /mysvc/bin/start -Dhttps.port=9443 -Dplay.crypto.secret=secret | |
else | |
while echo Client sleeping... ; do sleep 300 ; done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment