Skip to content

Instantly share code, notes, and snippets.

@lucivaldo
Last active June 26, 2023 22:32
Show Gist options
  • Save lucivaldo/bbd000963e3c8bc5b96d8784ff89841e to your computer and use it in GitHub Desktop.
Save lucivaldo/bbd000963e3c8bc5b96d8784ff89841e to your computer and use it in GitHub Desktop.
Exemplo de arquivo Dockerfile para projetos Rails somente API usando Alpine e com banco de dados SQLite
version: '3.7'
services:
web:
build: .
ports:
- ${WEB_PORT:-3000}:3000
volumes:
- public:/app/public
- .:/app
stdin_open: true
tty: true
volumes:
public:
driver: local
FROM ruby:3.2.2-alpine
LABEL maintainer="Lucivaldo Castro <lucivaldocb@gmail.com>"
RUN apk update && apk add --virtual build-dependencies build-base
RUN apk add \
less \
mailcap \
sqlite-dev \
tzdata
# Set timezone env
ENV TZ America/Araguaina
# Set Timezone
RUN cp /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Set locale
ENV LANG pt_BR.UTF-8
ENV LANGUAGE pt_BR.UTF-8
ENV LC_ALL pt_BR.UTF-8
RUN mkdir /app
WORKDIR /app
COPY Gemfile .
COPY Gemfile.lock .
RUN bundle install
COPY . /app
CMD ["./start.sh"]
RUN apk del build-dependencies
#!/bin/sh
rm -rf /app/tmp/pids/server.pid
bundle exec rails server -b 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment