Skip to content

Instantly share code, notes, and snippets.

@revgum
Last active February 27, 2022 15:41
Show Gist options
  • Save revgum/ebdc2ef4316373705b93002af2741bf9 to your computer and use it in GitHub Desktop.
Save revgum/ebdc2ef4316373705b93002af2741bf9 to your computer and use it in GitHub Desktop.
Lucky Framework Docker Development
  1. Install Lucky in order to initialize projects: https://luckyframework.org/guides/installing/

  2. Initialize a new project, then change to the project directory:

$lucky init my_project

$cd my_project

  1. Add the Dockerfile, docker-compose.yml, and docker-compose.override.yml files the root directory of the project. Dockerfile exists to build the application based off of a Docker image that I built to run Lucky: https://hub.docker.com/r/revgum/lucky/)

  2. Build the application $docker-compose build

  3. Start the application in docker $docker-compose up

version: "3"
services:
web:
ports:
- 5000:5000
- 3001:3001
- 3002:3002
version: "3"
services:
db:
image: postgres
environment:
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: postgres_pass
volumes:
- db:/var/lib/postgresql
networks:
- internal
web:
build:
context: .
dockerfile: Dockerfile
environment:
DATABASE_URL: postgres://postgres_user:postgres_pass@db:5432/first_development
SHARDS_CACHE_PATH: /data/.shards
volumes:
- .:/data
depends_on:
- db
networks:
- internal
- external
command: >
bash -c "shards install && yarn && lucky db.create && lucky db.migrate && lucky dev"
expose:
- 5000
stdin_open: true
tty: true
volumes:
db:
networks:
external:
internal:
FROM revgum/lucky
RUN mkdir /data
WORKDIR /data
ADD . /data
EXPOSE 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment