Last active
June 26, 2023 22:32
-
-
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
This file contains 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.7' | |
services: | |
web: | |
build: . | |
ports: | |
- ${WEB_PORT:-3000}:3000 | |
volumes: | |
- public:/app/public | |
- .:/app | |
stdin_open: true | |
tty: true | |
volumes: | |
public: | |
driver: local |
This file contains 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 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 |
This file contains 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
#!/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