Skip to content

Commit 11a5537

Browse files
authored
Merge pull request #521 from webkom/build-fix
Update to node 16 & fix some build errors
2 parents 9125077 + 72fafa2 commit 11a5537

File tree

7 files changed

+32
-11
lines changed

7 files changed

+32
-11
lines changed

.drone.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ name: default
55

66
steps:
77
- name: setup
8-
image: node:14
8+
image: node:16-alpine
99
when:
1010
event:
1111
- push
1212
commands:
1313
- yarn install --frozen-lockfile --ignore-scripts
1414

1515
- name: lint
16-
image: node:14
16+
image: node:16-alpine
1717
when:
1818
event:
1919
- push
@@ -23,7 +23,7 @@ steps:
2323
- yarn lint
2424

2525
- name: test
26-
image: node:14
26+
image: node:16-alpine
2727
when:
2828
event:
2929
- push
@@ -33,7 +33,7 @@ steps:
3333
- MONGO_URL=mongodb://mongodb:27017/vote-test REDIS_URL=redis yarn mocha
3434

3535
- name: coverage
36-
image: node:14
36+
image: node:16-alpine
3737
when:
3838
event:
3939
- push
@@ -49,7 +49,7 @@ steps:
4949
COVERALLS_SERVICE_NUMBER: ${DRONE_BUILD_NUMBER}
5050

5151
- name: build
52-
image: node:14
52+
image: node:16-alpine
5353
when:
5454
event:
5555
- push
@@ -137,4 +137,4 @@ services:
137137

138138
---
139139
kind: signature
140-
hmac: 21eea9888fa631a87ec5a02ee2d6f8f5c2b41767ecbe7f9fe0ee4d66e03325c6
140+
hmac: 1ec26cb4fae5d5b6f779d65ff5bd4dd4063ec3770e5527ef8c3447e0c700c9f8

Dockerfile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM node:14-slim
2-
MAINTAINER Abakus Webkom <webkom@abakus.no>
1+
FROM node:16-alpine as builder
2+
LABEL org.opencontainers.image.authors="Abakus Webkom <webkom@abakus.no>"
33

44
# Create app directory
55
RUN mkdir -p /app
@@ -11,7 +11,19 @@ EXPOSE 3000
1111
COPY . /app
1212

1313
# Build image
14-
RUN yarn --production
14+
RUN yarn --ignore-scripts
15+
ENV NODE_ENV production
16+
RUN yarn build
17+
18+
FROM node:16-alpine
19+
20+
WORKDIR /app
21+
22+
COPY --from=builder /app/bin bin
23+
COPY --from=builder /app/public public
24+
COPY --from=builder /app/dist dist
25+
COPY --from=builder /app/package.json .
26+
COPY --from=builder /app/node_modules node_modules
1527

1628
ARG RELEASE
1729
ENV RELEASE ${RELEASE}

app/digital/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ <h2>{{title}}</h2>
218218
{{/if}}
219219
{{#unless new}}
220220
<hr/>
221-
<p>Du har allerede motatt en bruker, og vi har registrert at du har klart å logge inn. Det vil si at du ikke vi få tilsendt en nytt brukernavn og passord. Ta kontakt med webkom dersom du mener dette er feil.
221+
<p>Du har allerede motatt en bruker, og vi har registrert at du har klart å logge inn. Det vil si at du ikke vil få tilsendt et nytt brukernavn og passord. Ta kontakt med webkom dersom du mener dette er feil.
222222
<hr/>
223223
{{/unless}}
224224
</center>

app/errors/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ export const handleError = (
287287
status?: number
288288
): Response => {
289289
const statusCode = status || err.status || 500;
290+
if (statusCode >= 500) {
291+
console.error(err);
292+
}
290293
return res.status(statusCode).json(
291294
err.payload || {
292295
name: err.name,

global.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ declare module '*.yml' {
33
const data: any;
44
export default data;
55
}
6+
7+
declare module '*.html' {
8+
const content: string;
9+
export default content;
10+
}

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const path = require('path');
44
module.exports = {
55
mode: 'none',
66
output: {
7-
path: path.resolve(__dirname, '../', 'public'),
7+
path: path.resolve(__dirname, 'dist', 'public'),
88
filename: '[name].js',
99
publicPath: '/static/',
1010
},

webpack.server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ module.exports = {
4141
patterns: [
4242
{ from: 'app/views', to: 'app/views' },
4343
{ from: 'public', to: 'public' },
44+
{ from: 'app/digital/template.html', to: './template.html' },
4445
],
4546
}),
4647
],

0 commit comments

Comments
 (0)