Skip to content

Instantly share code, notes, and snippets.

@yohanmishkin
yohanmishkin / doc.md
Last active December 31, 2019 07:06
Multi-stage builds in docker

Multi-stage builds in docker

Having spent a bit of time working to dockerize an API I wanted to share one of my learnings in case it’s helpful or interesting to others.

Granting access to private git repositories

The first issue I ran into was how to authenticate requests to gems we host privately on Github. We do this quite a bit throughout our repos.

So I needed a way to grant access to our docker image in order for bundler to run properly. Because were trying to build for production deployment I first decided to remove HTTPS repository references (https://github.com/ldock/) and replace them with SSH URLs ([email protected]:ldock/). But this introduced the challenge of getting the private key on the container securely. I needed the ability to get an authorized SSH key on the image when dependencies were being installed (bundle install) but I did not want to leave the key on the file system after the dependencies were installed.

@erdostom
erdostom / Dockerfile
Last active December 26, 2024 08:25
Good starter Dockerfile + docker-compose.yml for Rails 6.
FROM ruby:2.6.5-alpine
RUN apk add --update --no-cache bash build-base nodejs sqlite-dev tzdata postgresql-dev yarn
RUN gem install bundler:2.1.4
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --check-files
@maisonm
maisonm / userRoutes.js
Last active September 22, 2021 12:34
const jwt = require('jsonwebtoken');
const user = require('../../models/dummyUser');
module.exports = (app) => {
app.post('/user/login', (req, res, next) => {
const { body } = req;
const { username } = body;
const { password } = body;
@bultas
bultas / gist:3fcd11d8e5e31e93562d
Created March 18, 2015 21:24
GIT - how to replace master branch with another branch
http://stackoverflow.com/questions/2862590/how-to-replace-master-branch-in-git-entirely-from-another-branch
You should be able to use the "ours" merge strategy to overwrite master with AnotherBranch like this:
git checkout AnotherBranch
git merge -s ours master
git checkout master
git merge AnotherBranch
The result should be your master is now essentially AnotherBranch.