im not familiar with docker at all. im trying to use symfony with docker (windows). for docker i use (without changes, only +mysql)
https://github.com/dunglas/symfony-docker
it works well
problem that when i change files or create new files changes not sync, only after new build.
Please tell how to write proper dockerfile so files from host (and from docker) will be in sync
i need to use docker volumes, but idk how 😁
dockerfile
ARG PHP_VERSION=8.1
ARG CADDY_VERSION=2
# "php" stage
FROM php:${PHP_VERSION}-fpm-alpine AS symfony_php
# persistent / runtime deps
RUN apk add --no-cache \
acl \
fcgi \
file \
gettext \
git \
;
ARG APCU_VERSION=5.1.21
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-data-full \
icu-dev \
libzip-dev \
zlib-dev \
; \
\
docker-php-ext-configure zip; \
docker-php-ext-install -j$(nproc) \
intl \
zip \
; \
pecl install \
apcu-${APCU_VERSION} \
; \
pecl clear-cache; \
docker-php-ext-enable \
apcu \
opcache \
; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-cache --virtual .phpexts-rundeps $runDeps; \
\
apk del .build-deps
RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable pdo_mysql
COPY docker/php/docker-healthcheck.sh /usr/local/bin/docker-healthcheck
RUN chmod +x /usr/local/bin/docker-healthcheck
HEALTHCHECK --interval=10s --timeout=3s --retries=3 CMD ["docker-healthcheck"]
RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY docker/php/conf.d/symfony.prod.ini $PHP_INI_DIR/conf.d/symfony.ini
COPY docker/php/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/zz-docker.conf
COPY docker/php/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
VOLUME /var/run/php
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV PATH="${PATH}:/root/.composer/vendor/bin"
WORKDIR /srv/app
# Allow to choose skeleton
ARG SKELETON="symfony/skeleton"
ENV SKELETON ${SKELETON}
# Allow to use development versions of Symfony
ARG STABILITY="stable"
ENV STABILITY ${STABILITY}
# Allow to select skeleton version
ARG SYMFONY_VERSION=""
ENV SYMFONY_VERSION ${SYMFONY_VERSION}
# Download the Symfony skeleton and leverage Docker cache layers
#RUN composer create-project "${SKELETON} ${SYMFONY_VERSION}" . --stability=$STABILITY --prefer-dist --no-dev --no-progress --no-interaction; \
# composer clear-cache
###> recipes ###
###> doctrine/doctrine-bundle ###
#RUN apk add --no-cache --virtual .pgsql-deps postgresql-dev; \
# docker-php-ext-install -j$(nproc) pdo_pgsql; \
# apk add --no-cache --virtual .pgsql-rundeps so:libpq.so.5; \
# apk del .pgsql-deps
###< doctrine/doctrine-bundle ###
###< recipes ###
COPY . .
RUN set -eux; \
mkdir -p var/cache var/log; \
composer install --prefer-dist --no-dev --no-progress --no-scripts --no-interaction; \
composer dump-autoload --classmap-authoritative --no-dev; \
composer symfony:dump-env prod; \
composer run-script --no-dev post-install-cmd; \
chmod +x bin/console; sync
VOLUME /srv/app/var
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
FROM caddy:${CADDY_VERSION}-builder-alpine AS symfony_caddy_builder
RUN xcaddy build \
--with github.com/dunglas/mercure \
--with github.com/dunglas/mercure/caddy \
--with github.com/dunglas/vulcain \
--with github.com/dunglas/vulcain/caddy
FROM caddy:${CADDY_VERSION} AS symfony_caddy
WORKDIR /srv/app
COPY --from=dunglas/mercure:v0.11 /srv/public /srv/mercure-assets/
COPY --from=symfony_caddy_builder /usr/bin/caddy /usr/bin/caddy
COPY --from=symfony_php /srv/app/public public/
COPY docker/caddy/Caddyfile /etc/caddy/Caddyfile
docker-compose
version: "3.4"
services:
db:
image: mysql
# NOTE: use of "mysql_native_password" is not recommended: https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password
# (this is just an example, not intended to be a production configuration)
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
adminer:
image: adminer
restart: always
ports:
- 8080:8080
php:
build:
context: .
target: symfony_php
args:
SYMFONY_VERSION: ${SYMFONY_VERSION:-}
SKELETON: ${SKELETON:-symfony/skeleton}
STABILITY: ${STABILITY:-stable}
restart: unless-stopped
volumes:
- php_socket:/var/run/php
healthcheck:
interval: 10s
timeout: 3s
retries: 3
start_period: 30s
environment:
MERCURE_URL: ${CADDY_MERCURE_URL:-http://caddy/.well-known/mercure}
MERCURE_PUBLIC_URL: https://${SERVER_NAME:-localhost}/.well-known/mercure
MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
caddy:
build:
context: .
target: symfony_caddy
depends_on:
- php
environment:
SERVER_NAME: ${SERVER_NAME:-localhost, caddy:80}
MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeMe!}
restart: unless-stopped
volumes:
- php_socket:/var/run/php
- caddy_data:/data
- caddy_config:/config
ports:
# HTTP
- target: 80
published: ${HTTP_PORT:-80}
protocol: tcp
# HTTPS
- target: 443
published: ${HTTPS_PORT:-443}
protocol: tcp
# HTTP/3
- target: 443
published: ${HTTP3_PORT:-443}
protocol: udp
volumes:
php_socket:
caddy_data:
caddy_config:
This is not something you declare on the dockerfile level, the dockerfile is a layer you tell the container (or the host) to add the container in it's run time. (Installations, copies..)
this a flag on the docker API `docker run -v vol:vol .... ```
Or inside of the docker-compose file
I see your docker-compose file has a declaration of volumes for service caddy.
Try to init the volume as an empty one
# bottom of the docker-compose file
volumes:
php_socket: {}
Docker is built upon layers, every change you'll make, will create a new layer and will be saved on the volume.
Related
I have a profile page in my app which I am migrating to docker. I want to have a default profile picture for user who don't upload any picture for that I need to store that picture in my container.
I have my default profile pic stored at data/web/media/default.jpg and want it to copy to vol/web/media/default.jpg in my docker container.
I tried COPY but got this error
failed to solve: rpc error: code = Unknown desc = failed to compute cache key: "/data" not found: not found
My dockerfile :
FROM python:3.9-alpine3.13
LABEL maintainer="mRk"
ENV PYTHONUNBUFFERED 1
COPY ./requirements.txt /requirements.txt
COPY ./app /app
COPY ./scripts /scripts
COPY ./data /vol
WORKDIR /app
EXPOSE 8000
RUN python -m venv /py && \
/py/bin/pip install --upgrade pip && \
apk add --update --no-cache postgresql-client && \
apk add --update --no-cache --virtual .tmp-deps \
build-base postgresql-dev musl-dev linux-headers && \
apk add --virtual build-deps gcc python3-dev musl-dev && \
apk add jpeg-dev zlib-dev libjpeg && \
pip install Pillow && \
apk del build-deps && \
/py/bin/pip install -r /requirements.txt && \
apk del .tmp-deps && \
adduser --disabled-password --no-create-home app && \
mkdir -p /vol/web/static && \
mkdir -p /vol/web/media && \
cp ./data/web/media/default.jpg /vol/web/media/default.jpg && \
chown -R app:app /vol && \
chmod -R 755 /vol && \
chmod -R +x /scripts
ENV PATH="/scripts:/py/bin:$PATH"
USER app
CMD ["run.sh"]
My docker-compose file :
version: "3.9"
services:
app:
build:
context: .
restart: always
volumes:
- static-data:/vol/web
environment:
- DB_HOST=db
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
- SECRET_KEY=${SECRET_KEY}
- ALLOWED_HOSTS=${ALLOWED_HOSTS}
- EMAIL_USER=${EMAIL_USER}
- EMAIL_PASS=${EMAIL_PASS}
depends_on:
- db
db:
image: postgres:13-alpine
restart: always
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASS}
proxy:
build:
context: ./proxy
restart: always
depends_on:
- app
ports:
- 80:8000
volumes:
- static-data:/vol/static
volumes:
postgres-data:
static-data:
It looks like you try to copy something from the data dir:
cp ./data/web/media/default.jpg /vol/web/media/default.jpg && \
But this directory does not exist. However, you copied everything from the data dir on your host machine into your container dir vol on line:
COPY ./data /vol
That means, that all your files and dirs from data or copied into the vol dir in the container. So I geuss you do not need that line at all, as it is already in your container but in the vol directory.
This line isn't going to work since you set your WORKDIR to /app/ earlier.
cp ./data/web/media/default.jpg /vol/web/media/default.jpg && \
You have to change your working directory or use an absolute path
An other solution would be to put this line below the RUN command since you don't need to be in the /app/ directory to run it:
WORDIR = /app/
You can use docker volumes which help you to copy and read files from docker
https://docs.docker.com/storage/volumes/
I made docker images and built them using docker-compose.yml, everything works fine for the first time but when I add/update some configurations on the Dockerfiles and rebuild the images an error regarding the group or the user I am creating inside the image generates:
> [ 2/11] RUN addgroup -g 1000 laravel && adduser -G laravel -g laravel -s /bin/sh -D laravel:
#5 0.396 addgroup: group 'laravel' in use
Here I am adding laravel as user and group.
The only work around I make is to delete all the built images: docker system prune -a
Below are Docker files and docker-compose.yml file configuration:
.env file:
PROJECT_NAME=myproject
DEV_DOMAIN=docker.local
USERNAME=laravel
UID=1000
PHP_VERSION=7.4-fpm-alpine
MYSQL_VERSION=latest
MYSQL_DATABASE=local_db
MYSQL_USER=homestead
MYSQL_PASSWORD=secret
XDEBUG_REMOTE_HOST=172.31.33.213
XDEBUG_IDE_KEY=VSCODE
XDEBUG_PORT=7765
docker-compose.yml:
version: "3.5"
services:
nginx:
build:
args:
user: ${USERNAME}
uid: ${UID}
context: .
dockerfile: ./docker/nginx/Dockerfile
image: "nginx:stable-alpine"
container_name: ${PROJECT_NAME}-nginx
ports:
- 80:80
volumes:
- "./code:/var/www/html"
- "./docker/nginx/vhost:/etc/nginx/conf.d/default.conf"
- "./docker/nginx/nginx.conf:/etc/nginx/nginx.conf"
depends_on:
- php
- mysql
networks:
- devproject
php:
build:
args:
PHP_VERSION: ${PHP_VERSION}
user: ${USERNAME}
uid: ${UID}
XDEBUG_REMOTE_HOST: ${XDEBUG_REMOTE_HOST}
XDEBUG_IDE_KEY: ${XDEBUG_IDE_KEY}
XDEBUG_PORT: ${XDEBUG_PORT}
context: .
dockerfile: ./docker/php/Dockerfile
image: php:${PHP_VERSION}
container_name: ${PROJECT_NAME}-php
volumes:
- "./code:/var/www/html"
- "./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf"
ports:
- 9000:9000
networks:
- devproject
mysql:
image: mysql:${MYSQL_VERSION}
container_name: ${PROJECT_NAME}-mysql
restart: unless-stopped
tty: true
ports:
- 3306:3306
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- devprojectmysql:/var/lib/mysql
networks:
- devproject
networks:
devproject:
driver: bridge
volumes:
devprojectmysql:
driver: local
docker/php/Dockerfile:
ARG PHP_VERSION
FROM php:$PHP_VERSION
ARG XDEBUG_REMOTE_HOST
ARG XDEBUG_IDE_KEY
ARG XDEBUG_PORT
ARG user
ARG uid
ENV XDEBUG_REMOTE_HOST $XDEBUG_REMOTE_HOST
ENV XDEBUG_IDE_KEY $XDEBUG_IDE_KEY
ENV XDEBUG_PORT $XDEBUG_PORT
RUN addgroup -g $uid $user && adduser -G $user -g $user -s /bin/sh -D $user
RUN mkdir -p /var/www/html
RUN chown $user:$user /var/www/html
WORKDIR /var/www/html
RUN apk add --no-cache --update icu-dev gettext gettext-dev git curl libpng-dev libzip-dev \
libmcrypt-dev libpng-dev libjpeg-turbo-dev libxml2-dev icu-dev postgresql-dev curl-dev \
libmemcached-dev build-base autoconf zip unzip oniguruma-dev &&\
apk add --update --virtual build-dependencies build-base gcc wget autoconf
RUN pecl install xdebug-3.0.4
RUN docker-php-ext-install gd ctype fileinfo mysqli pdo pdo_mysql mbstring exif pcntl bcmath xml curl json intl gettext tokenizer zip simplexml
RUN docker-php-ext-configure intl &&\
docker-php-ext-configure gettext &&\
docker-php-ext-enable xdebug
RUN apk del build-dependencies &&\
rm -rf /var/cache/apk/* &&\
rm -rf /var/lib/apt/lists/*
RUN echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_log=/tmp/xdebug_remote.log" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_port=$XDEBUG_PORT" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.idekey=$XDEBUG_IDE_KEY" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_host=$XDEBUG_REMOTE_HOST" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
docker/nginx/Dockerfile:
FROM nginx:stable-alpine
# Arguments defined in docker-compose.yml
ARG user
ARG uid
RUN mkdir -p /var/www/html
RUN addgroup -g $uid $user && adduser -G $user -g $user -s /bin/sh -D $user
RUN chown $user:$user /var/www/html
The image field in the compose file, e.g.
image: php:${PHP_VERSION}
Is the image you are creating. You have named your created images the same as your base images in the Dockerfile, overwriting the upstream names. This is a bug in your compose file, and confusing to others since running an image with that name does different things depending on whether you pull the upstream image or run your locally built image.
Instead your compose file should name images with something in your own registry namespace to avoid collisions. In Hub that involves prepending your Hub username:
image: <hubuser>/<appname>:<tag>
I have this docker-compose config.
The "app" is a PHP application. As you can see, 3 env vars are passed to the container.
However, after docker-compose up, PHP doesn't see these. They are not returned by getenv() and they cannot be found $_ENV either.
What's wrong here?
version: '3.4'
services:
db:
image: postgres:11.0
restart: always
environment:
POSTGRES_PASSWORD: testuser
POSTGRES_USER: test
POSTGRES_DB: db
volumes:
- /data/db
redis:
image: redis:latest
restart: always
volumes:
- /data/redis
app:
build:
context: .
dockerfile: Dockerfile
environment:
- DATABASE_URL=postgresql://db:5432/db
- REDIS_URL=tcp://redis:6379?database=1
- NODE_ENV=development
ports:
- '80:80'
volumes:
- '${BASEDIR}:/var/www/some'
Here is my Dockerfile:
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
software-properties-common \
apt-utils \
tzdata \
locales
RUN add-apt-repository ppa:ondrej/php
RUN apt-get update
RUN locale-gen en_US.UTF-8
RUN echo "Europe/Budapest" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
RUN apt-get -y update && apt-get -y install \
libglu1-mesa \
less \
vim \
nginx \
php7.4 \
php7.4-fpm \
php7.4-cli \
php7.4-common \
php7.4-curl \
php-deepcopy \
php7.4-gd \
php7.4-mbstring \
php7.4-pgsql \
php7.4-soap \
php7.4-xdebug \
php7.4-zip \
php7.4-xml \
phpunit \
npm && npm i -g npm
ENV NGINX_RUN_USER www-data
ENV NGINX_RUN_GROUP www-data
ENV NGINX_LOG_DIR /var/log/nginx
ENV NGINX_LOCK_DIR /var/lock/nginx
ENV NGINX_PID_FILE /run/nginx.pid
RUN mkdir www
RUN mkdir -p /var/www/dbv.local/html
RUN chmod -R 755 /var/www/dbv.local
COPY ./php.ini /etc/php/7.4/fpm/php.ini
COPY ./dbv.local /etc/nginx/sites-available/dbv.local
COPY ./lib/aspose_php.so /usr/lib/php/20190902
COPY ./lib/libaspose_cpp_clang3_libstdcpp.so /usr/lib/libaspose_cpp_clang3_libstdcpp.so
COPY ./lib/libAspose.Slides_clang3_libstdcpp.so /usr/lib/libAspose.Slides_clang3_libstdcpp.so
COPY ./lib/libphpcpp.so.2.2 /usr/lib/libphpcpp.so.2.2
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN ln -s /etc/nginx/sites-available/dbv.local /etc/nginx/sites-enabled/
ADD ./xdebug.ini /etc/php/7.4/mods-available/xdebug.ini
ADD ./aspose_php.ini /etc/php/7.4/mods-available/aspose_php.ini
ADD ./start.sh /root/start.sh
RUN ln -s /etc/php/7.4/mods-available/xdebug.ini /etc/php/7.4/mods-available/20-xdebug.ini
RUN ln -s /etc/php/7.4/mods-available/aspose_php.ini /etc/php/7.4/fpm/conf.d/aspose_php.ini
RUN ln -s /etc/php/7.4/mods-available/aspose_php.ini /etc/php/7.4/cli/conf.d/aspose_php.ini
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get clean
CMD ["/root/start.sh"]
EXPOSE 80 9000 5432
Edit:
start.sh is just a one liner
service php7.4-fpm start && nginx
Ubuntu 18 is necessary. I could use an official Nginx image though. Maybe that's the issue?
My container is up an running successfully - i'm on a MacOS Catalina;
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
487b211c7300 laravel-demo_laravel-app "docker-php-entrypoi…" 6 seconds ago Up 5 seconds 9000/tcp, 9021/tcp, 0.0.0.0:8021->80/tcp laravel-app
My docker-compose.yml looks like;
version: '3'
services:
#Laravel App
laravel-app:
build:
context: .
dockerfile: ./Dockerfile
container_name: laravel-app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: laravel-app
SERVICE_TAGS: dev
working_dir: /var/www/html
ports:
- 8021:80
volumes:
- ./:/var/www/html
and my Dockerfile
FROM php:7.2-fpm-alpine
# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/html/
# Set working directory
WORKDIR /var/www/html
# Install Additional dependencies
RUN apk update && apk add --no-cache \
build-base shadow vim curl \
php7 \
php7-fpm \
php7-common \
php7-pdo \
php7-pdo_mysql \
php7-mysqli \
php7-mcrypt \
php7-mbstring \
php7-xml \
php7-openssl \
php7-json \
php7-phar \
php7-zip \
php7-gd \
php7-dom \
php7-session \
php7-zlib
# Add and Enable PHP-PDO Extenstions
RUN docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-enable pdo_mysql
# Install PHP Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --
filename=composer
# Remove Cache
RUN rm -rf /var/cache/apk/*
# Add UID '1000' to www-data
RUN usermod -u 1000 www-data
RUN usermod -u 501 www-data
# Copy existing application directory permissions
COPY --chown=www-data:www-data . /var/www/html
# Change current user to www
USER www-data
These two files are both on the root of my fresh Laravel install.
Internal/external ports look fine in my config and with docker ps reporting success - my app should launch in a browser no? In theory - I should see the Laravel splash-screen;-
Well, unfortunately it doesn't and it's kicking my ass.
Things I've tried;
EXPOSE 9000
CMD ["php-fpm", "--host", "http://localhost"]
and
#CMD ["php-fpm", "--host", "0.0.0.0"]
Plus, various implementations of docker-compose.yml - like removing the environment: parameter - but no joy.
By comparing my Dockerfile & docker-compose.yml - are you able to offer some clues?
Thanks
If you cant beat em - join em;-
https://hub.docker.com/r/bitnami/laravel
when I start my container with docker-compose up my app eventually gets stuck and repeats itself over and over with these lines:
I, [2019-12-09T15:19:35.396147 #342] INFO -- : Refreshing Gem list
E, [2019-12-09T15:19:47.019123 #342] ERROR -- : No such file or directory # rb_sysopen - /usr/src/app/config/environments/development.rb (Errno::ENOENT)
.
.
.
The thing is, when I open the container bash and use ls, I can see that the file is in the path that he can't seem to find.
Any advice on how to fix this problem? Thank you!
EDIT: Dockerfile
FROM ruby:2.6.3-alpine3.9
ENV APP_HOME /usr/src/app
ENV CONTAINERNAME_ENVIRONMENT docker
EXPOSE 80
WORKDIR $APP_HOME
COPY Gemfile* $APP_HOME/
# general dependencies
RUN apk update
RUN set -ex \
&& apk add --no-cache libpq imagemagick nodejs bash gcompat git
# poltergeist, see https://github.com/Overbryd/docker-phantomjs-alpine/releases
ENV PHANHOME /usr/share
RUN apk add --no-cache fontconfig curl && \
mkdir -p $PHANHOME \
&& curl -L https://github.com/Overbryd/docker-phantomjs-alpine/releases/download/2.11/phantomjs-alpine-x86_64.tar.bz2 | tar xj -C $PHANHOME \
&& ln -s $PHANHOME/phantomjs/phantomjs /usr/bin/phantomjs \
&& phantomjs --version
# build dependencies
RUN set -ex \
&& apk add --no-cache --virtual builddependencies \
linux-headers \
libpq \
tzdata \
build-base \
postgresql-dev \
imagemagick-dev \
&& bundle install \
&& apk del builddependencies
CMD ["bundle", "exec", "unicorn", "--port", "80"]
EDIT: docker-compose.yml
version: '3'
services:
postgresql:
image: postgres:9.6.2-alpine
container_name: postgresql-dev
environment:
- APPLICATION=myapp
- POSTGRES_PASSWORD=myapp
- POSTGRES_USER=my_app
- POSTGRES_DB=myapp
ports:
- 5432:5432
imimap:
build: .
image: myapp:dev
container_name: myapp-dev
environment:
- APPLICATION=myapp
- POSTGRES_PASSWORD=myapp
- POSTGRES_USER=my_app
- POSTGRES_DB=myapp
- RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
- LDAP=${LDAP}
depends_on:
- postgresql
volumes:
- ./logc:/usr/src/app/log
- .:/usr/src/app
links:
- postgresql
ports:
- 8080:80
#entrypoint:
# - ci-cd/stall.sh