Skip to content

Commit 55a78d7

Browse files
author
Rune Ettrup
committed
Add dockerfile
1 parent 08a11d0 commit 55a78d7

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Use a specific version to be repeatable
2+
FROM phusion/baseimage:0.9.20
3+
4+
# Use baseimage-docker's init system
5+
CMD ["/sbin/my_init"]
6+
7+
# Add a script to run the a smashing app
8+
ADD docker/smashing.sh /etc/service/smashing/run
9+
10+
RUN apt-get update && \
11+
apt-get -y install nodejs git vim gcc g++ ruby gem ruby-dev make && \
12+
apt-get -y clean
13+
14+
# Set up the default app
15+
RUN mkdir -p /vol/smashing
16+
COPY . /vol/smashing-src
17+
18+
WORKDIR /vol/smashing-src
19+
RUN gem build smashing.gemspec
20+
RUN gem install ./smashing-1.0.0.gem bundler
21+
22+
WORKDIR /vol/
23+
RUN smashing new smashing && \
24+
cd /vol/smashing && \
25+
bundle && \
26+
mkdir /vol/smashing/config && \
27+
mv /vol/smashing/config.ru /vol/smashing/config/config.ru && \
28+
ln -s /vol/smashing/config/config.ru /vol/smashing/config.ru
29+
30+
# Clean up
31+
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
32+
33+
# Define mountable directories
34+
VOLUME ["/vol/smashing/dashboards", "/vol/smashing/jobs", "/vol/smashing/lib-smashing", "/vol/smashing/config", "/vol/smashing/public", "/vol/smashing/widgets", "/vol/smashing/assets"]
35+
36+
ENV PORT 3030
37+
EXPOSE 3030
38+
WORKDIR /vol/smashing

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
NAME = smashing
2+
VERSION = $(shell git describe --tags)
3+
REGISTRY = 448220486850.dkr.ecr.eu-west-1.amazonaws.com
4+
5+
all: build
6+
7+
build:
8+
docker build -t $(NAME):$(VERSION) --rm .
9+
10+
test:
11+
@echo "*** NO TESTS DECLARED"
12+
13+
tag_latest:
14+
docker tag $(NAME):$(VERSION) $(NAME):latest
15+
16+
release: build test tag_latest
17+
@echo "Tagging container"
18+
docker tag $(NAME):latest $(REGISTRY)/$(NAME):$(VERSION)
19+
docker tag $(NAME):latest $(REGISTRY)/$(NAME):latest
20+
@echo "Pushing to docker registry, please be patient"
21+
docker push $(REGISTRY)/$(NAME):$(VERSION)
22+
docker push $(REGISTRY)/$(NAME):latest
23+
@echo "*** Don't forget to create a tag. git tag rel-$(VERSION) && git push origin rel-$(VERSION)"
24+
25+
clean:
26+
ifneq ($(shell docker images -q $(NAME):latest),)
27+
docker rmi $(NAME):latest
28+
endif
29+
ifneq ($(shell docker images -q $(NAME):$(VERSION)),)
30+
docker rmi $(NAME):$(VERSION)
31+
endif
32+
ifneq ($(shell docker images -q $(REGISTRY)/$(NAME):latest),)
33+
docker rmi $(REGISTRY)/$(NAME):latest
34+
endif
35+
ifneq ($(shell docker images -q $(REGISTRY)/$(NAME):$(VERSION)),)
36+
docker rmi $(REGISTRY)/$(NAME):$(VERSION)
37+
endif
38+
39+
40+
.PHONY: all build test tag_latest release clean

docker/smashing.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
cd /vol/smashing; ./smashing start -p $PORT

0 commit comments

Comments
 (0)